diff --git a/src/Value.php b/src/Value.php index c36b5ea..6ff9305 100644 --- a/src/Value.php +++ b/src/Value.php @@ -1,4 +1,6 @@ -scope = $scope; - + return $this; } - + public function withoutScope(): self { $this->scope = null; - + return $this; } - + public function withLocale(string $locale): self { $this->locale = $locale; - + return $this; } - + public function withoutLocale(): self { $this->locale = null; - + return $this; } diff --git a/src/WithMultipleOption.php b/src/WithMultipleOption.php index 56f75b1..f312a20 100644 --- a/src/WithMultipleOption.php +++ b/src/WithMultipleOption.php @@ -23,21 +23,21 @@ private function compile(string $codes, string $attribute, string $labels, strin (function() { \$linkedData = array_map( function (string \$code) { - \$labels = $labels; + \$labels = {$labels}; } return [ - 'attribute' => $attribute, + 'attribute' => {$attribute}, 'code' => \$code, 'labels' => \$labels[\$code] ?? [], ]; }, - $codes, + {$codes}, ); return [ [ - 'data' => ($codes), - 'locale' => $locale, - 'scope' => $scope, + 'data' => ({$codes}), + 'locale' => {$locale}, + 'scope' => {$scope}, 'linked_data' => \$linkedData, ], ]; @@ -46,8 +46,8 @@ function (string \$code) { } /** - * @var list $codes - * @var array> $labels + * @var list + * @var array> */ private function evaluate(array $context, array $codes, string $attribute, array $labels, ?string $locale = null, ?string $scope = null): array { diff --git a/src/WithSimpleOption.php b/src/WithSimpleOption.php index 8fdac6d..5f8f28d 100644 --- a/src/WithSimpleOption.php +++ b/src/WithSimpleOption.php @@ -22,13 +22,13 @@ private function compile(string $code, string $attribute, string $labels, string return << ($code), - 'locale' => $locale, - 'scope' => $scope, + 'data' => ({$code}), + 'locale' => {$locale}, + 'scope' => {$scope}, 'linked_data' => [ - 'attribute' => ($attribute), - 'code' => ($code), - 'labels' => ($labels), + 'attribute' => ({$attribute}), + 'code' => ({$code}), + 'labels' => ({$labels}), ], ], ]) @@ -36,7 +36,7 @@ private function compile(string $code, string $attribute, string $labels, string } /** - * @var array $labels + * @var array */ private function evaluate(array $context, string $code, string $attribute, array $labels, ?string $locale = null, ?string $scope = null): array {