Skip to content

Commit

Permalink
cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
JoMessina committed Nov 19, 2024
1 parent de9bdbd commit e0a290a
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/Builder/Capacity/Lookup/All.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private function compileCodeNamedArgument(string $type): Node\Identifier
return match ($type) {
'referenceEntityRecord' => new Node\Identifier('referenceEntityCode'),
'assetManager' => new Node\Identifier('assetFamilyCode'),
default => new Node\Identifier('attributeCode')
default => new Node\Identifier('attributeCode'),
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/Builder/Capacity/Lookup/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private function compileCodeNamedArgument(string $type): Node\Identifier
return match ($type) {
'referenceEntityRecord' => new Node\Identifier('referenceEntityCode'),
'assetManager' => new Node\Identifier('assetFamilyCode'),
default => new Node\Identifier('attributeCode')
default => new Node\Identifier('attributeCode'),
};
}

Expand All @@ -154,7 +154,7 @@ private function compileIdentifierNamedArgument(string $type): Node\Identifier
return match ($type) {
'referenceEntityRecord' => new Node\Identifier('recordCode'),
'assetManager' => new Node\Identifier('assetCode'),
default => new Node\Identifier('code')
default => new Node\Identifier('code'),
};
}
}
4 changes: 2 additions & 2 deletions src/Builder/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
final class Search implements Builder
{
public function __construct(
private array $filters = []
private array $filters = [],
) {
}

Expand All @@ -19,7 +19,7 @@ public function addFilter(
Node\Expr $operator,
?Node\Expr $value = null,
?Node\Expr $scope = null,
?Node\Expr $locale = null
?Node\Expr $locale = null,
): self {
$arguments = [
new Node\Arg(
Expand Down
6 changes: 3 additions & 3 deletions src/Capacity/Extractor/All.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ private function compileFilters(array ...$filters): Node\Expr
$builder = new Akeneo\Builder\Search();
foreach ($filters as $filter) {
if (\in_array($filter['operator'], self::$unaryOperators, true) && \array_key_exists('value', $filter)) {
throw new InvalidConfigurationException(sprintf('You should not provide a value for the %s operator', $filter['operator']));
throw new InvalidConfigurationException(\sprintf('You should not provide a value for the %s operator', $filter['operator']));
}
if (!\in_array($filter['operator'], self::$unaryOperators, true) && !\array_key_exists('value', $filter)) {
throw new InvalidConfigurationException(sprintf('You should provide a value for the %s operator', $filter['operator']));
throw new InvalidConfigurationException(\sprintf('You should provide a value for the %s operator', $filter['operator']));
}

$builder->addFilter(
Expand All @@ -93,7 +93,7 @@ private function compileFilters(array ...$filters): Node\Expr
public function getBuilder(array $config): Builder
{
$builder = (new Akeneo\Builder\Capacity\Extractor\All())
->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst((string) $config['type']))))
->withEndpoint(new Node\Identifier(\sprintf('get%sApi', ucfirst((string) $config['type']))))
;

if (isset($config['search']) && \is_array($config['search']) && \count($config['search']) > 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/Capacity/Extractor/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function applies(array $config): bool
public function getBuilder(array $config): Builder
{
$builder = (new Akeneo\Builder\Capacity\Extractor\Get())
->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst((string) $config['type']))))
->withEndpoint(new Node\Identifier(\sprintf('get%sApi', ucfirst((string) $config['type']))))
;

$builder->withIdentifier(compileValueWhenExpression($this->interpreter, $config['identifier']));
Expand Down
6 changes: 3 additions & 3 deletions src/Capacity/Extractor/ListPerPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ private function compileFilters(array ...$filters): Node\Expr
$builder = new Akeneo\Builder\Search();
foreach ($filters as $filter) {
if (\in_array($filter['operator'], self::$unaryOperators, true) && \array_key_exists('value', $filter)) {
throw new InvalidConfigurationException(sprintf('You should not provide a value for the %s operator', $filter['operator']));
throw new InvalidConfigurationException(\sprintf('You should not provide a value for the %s operator', $filter['operator']));
}
if (!\in_array($filter['operator'], self::$unaryOperators, true) && !\array_key_exists('value', $filter)) {
throw new InvalidConfigurationException(sprintf('You should provide a value for the %s operator', $filter['operator']));
throw new InvalidConfigurationException(\sprintf('You should provide a value for the %s operator', $filter['operator']));
}

$builder->addFilter(
Expand All @@ -91,7 +91,7 @@ private function compileFilters(array ...$filters): Node\Expr
public function getBuilder(array $config): Builder
{
$builder = (new Akeneo\Builder\Capacity\Extractor\ListPerPage())
->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst((string) $config['type']))))
->withEndpoint(new Node\Identifier(\sprintf('get%sApi', ucfirst((string) $config['type']))))
;

if (isset($config['search']) && \is_array($config['search'])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Capacity/Loader/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function applies(array $config): bool
public function getBuilder(array $config): Builder
{
return (new Akeneo\Builder\Capacity\Loader\Create())
->withEndpoint(endpoint: new Node\Identifier(sprintf('get%sApi', ucfirst((string) $config['type']))))
->withEndpoint(endpoint: new Node\Identifier(\sprintf('get%sApi', ucfirst((string) $config['type']))))
->withCode(code: compileValueWhenExpression($this->interpreter, $config['code'], 'line'))
->withData(line: new Node\Expr\Variable('line["product"]'))
;
Expand Down
2 changes: 1 addition & 1 deletion src/Capacity/Loader/Upsert.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function applies(array $config): bool
public function getBuilder(array $config): Builder
{
$builder = (new Akeneo\Builder\Capacity\Loader\Upsert())
->withEndpoint(endpoint: new Node\Identifier(sprintf('get%sApi', ucfirst((string) $config['type']))))
->withEndpoint(endpoint: new Node\Identifier(\sprintf('get%sApi', ucfirst((string) $config['type']))))
->withCode(code: compileValueWhenExpression($this->interpreter, $config['code'], 'line'))
->withData(line: new Node\Expr\Variable('line'))
;
Expand Down
2 changes: 1 addition & 1 deletion src/Capacity/Loader/UpsertList.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function applies(array $config): bool
public function getBuilder(array $config): Builder
{
$builder = (new Akeneo\Builder\Capacity\Loader\UpsertList())
->withEndpoint(endpoint: new Node\Identifier(sprintf('get%sApi', ucfirst((string) $config['type']))))
->withEndpoint(endpoint: new Node\Identifier(\sprintf('get%sApi', ucfirst((string) $config['type']))))
->withData(data: new Node\Expr\Variable('line'))
;

Expand Down
6 changes: 3 additions & 3 deletions src/Capacity/Lookup/All.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ private function compileFilters(array ...$filters): Node\Expr
$builder = new Akeneo\Builder\Search();
foreach ($filters as $filter) {
if (\in_array($filter['operator'], self::$unaryOperators, true) && \array_key_exists('value', $filter)) {
throw new InvalidConfigurationException(sprintf('You should not provide a value for the %s operator', $filter['operator']));
throw new InvalidConfigurationException(\sprintf('You should not provide a value for the %s operator', $filter['operator']));
}
if (!\in_array($filter['operator'], self::$unaryOperators, true) && !\array_key_exists('value', $filter)) {
throw new InvalidConfigurationException(sprintf('You should provide a value for the %s operator', $filter['operator']));
throw new InvalidConfigurationException(\sprintf('You should provide a value for the %s operator', $filter['operator']));
}

$builder->addFilter(
Expand All @@ -93,7 +93,7 @@ public function getBuilder(array $config): Builder
{
$builder = (new Akeneo\Builder\Capacity\Lookup\All())
->withType((string) $config['type'])
->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst((string) $config['type']))))
->withEndpoint(new Node\Identifier(\sprintf('get%sApi', ucfirst((string) $config['type']))))
;

if (isset($config['search']) && \is_array($config['search'])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Capacity/Lookup/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function applies(array $config): bool
public function getBuilder(array $config): Builder
{
$builder = (new Akeneo\Builder\Capacity\Lookup\Download())
->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst((string) $config['type']))))
->withEndpoint(new Node\Identifier(\sprintf('get%sApi', ucfirst((string) $config['type']))))
;

if (!\array_key_exists('file', $config)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Capacity/Lookup/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function applies(array $config): bool
public function getBuilder(array $config): Builder
{
$builder = (new Akeneo\Builder\Capacity\Lookup\Get())
->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst((string) $config['type']))))
->withEndpoint(new Node\Identifier(\sprintf('get%sApi', ucfirst((string) $config['type']))))
->withType($config['type'])
;

Expand Down
6 changes: 3 additions & 3 deletions src/Capacity/Lookup/ListPerPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ private function compileFilters(array ...$filters): Node\Expr
$builder = new Akeneo\Builder\Search();
foreach ($filters as $filter) {
if (\in_array($filter['operator'], self::$unaryOperators, true) && \array_key_exists('value', $filter)) {
throw new InvalidConfigurationException(sprintf('You should not provide a value for the %s operator', $filter['operator']));
throw new InvalidConfigurationException(\sprintf('You should not provide a value for the %s operator', $filter['operator']));
}
if (!\in_array($filter['operator'], self::$unaryOperators, true) && !\array_key_exists('value', $filter)) {
throw new InvalidConfigurationException(sprintf('You should provide a value for the %s operator', $filter['operator']));
throw new InvalidConfigurationException(\sprintf('You should provide a value for the %s operator', $filter['operator']));
}

$builder->addFilter(
Expand All @@ -91,7 +91,7 @@ private function compileFilters(array ...$filters): Node\Expr
public function getBuilder(array $config): Builder
{
$builder = (new Akeneo\Builder\Capacity\Lookup\ListPerPage())
->withEndpoint(new Node\Identifier(sprintf('get%sApi', ucfirst((string) $config['type']))))
->withEndpoint(new Node\Identifier(\sprintf('get%sApi', ucfirst((string) $config['type']))))
;

if (isset($config['search']) && \is_array($config['search'])) {
Expand Down
4 changes: 2 additions & 2 deletions src/Configuration/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder
->ifArray()
->then(function (array $item) {
if (!\in_array($item['method'], self::$endpoints[$item['type']])) {
throw new \InvalidArgumentException(sprintf('the value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), json_encode($item['method'], \JSON_THROW_ON_ERROR)));
throw new \InvalidArgumentException(\sprintf('the value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), json_encode($item['method'], \JSON_THROW_ON_ERROR)));
}

return $item;
Expand Down Expand Up @@ -211,7 +211,7 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder
->validate()
->ifNotInArray(array_keys(self::$endpoints))
->thenInvalid(
sprintf('the value should be one of [%s], got %%s', implode(', ', array_keys(self::$endpoints)))
\sprintf('the value should be one of [%s], got %%s', implode(', ', array_keys(self::$endpoints)))
)
->end()
->end()
Expand Down
4 changes: 2 additions & 2 deletions src/Configuration/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder
->ifArray()
->then(function (array $item) {
if (!\in_array($item['method'], self::$endpoints[$item['type']])) {
throw new \InvalidArgumentException(sprintf('the value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), json_encode($item['method'], \JSON_THROW_ON_ERROR)));
throw new \InvalidArgumentException(\sprintf('the value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), json_encode($item['method'], \JSON_THROW_ON_ERROR)));
}

return $item;
Expand Down Expand Up @@ -230,7 +230,7 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder
->validate()
->ifNotInArray(array_keys(self::$endpoints))
->thenInvalid(
sprintf('the value should be one of [%s]', implode(', ', array_keys(self::$endpoints)))
\sprintf('the value should be one of [%s]', implode(', ', array_keys(self::$endpoints)))
)
->end()
->end()
Expand Down
8 changes: 4 additions & 4 deletions src/Configuration/Lookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder
->ifTrue(fn ($data) => !\array_key_exists('conditional', $data) && \is_array($data))
->then(function (array $item) {
if (!\in_array($item['method'], self::$endpoints[$item['type']])) {
throw new \InvalidArgumentException(sprintf('The value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), json_encode($item['method'], \JSON_THROW_ON_ERROR)));
throw new \InvalidArgumentException(\sprintf('The value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), json_encode($item['method'], \JSON_THROW_ON_ERROR)));
}

return $item;
Expand All @@ -183,7 +183,7 @@ public function getConfigTreeBuilder(): Config\Definition\Builder\TreeBuilder
->validate()
->ifNotInArray(array_keys(self::$endpoints))
->thenInvalid(
sprintf('The value should be one of [%s], got %%s', implode(', ', array_keys(self::$endpoints)))
\sprintf('The value should be one of [%s], got %%s', implode(', ', array_keys(self::$endpoints)))
)
->end()
->end()
Expand Down Expand Up @@ -228,7 +228,7 @@ private function getConditionalTreeBuilder(): Config\Definition\Builder\TreeBuil
->ifArray()
->then(function (array $item) {
if (!\in_array($item['method'], self::$endpoints[$item['type']])) {
throw new \InvalidArgumentException(sprintf('the value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), json_encode($item['method'], \JSON_THROW_ON_ERROR)));
throw new \InvalidArgumentException(\sprintf('the value should be one of [%s], got %s', implode(', ', self::$endpoints[$item['type']]), json_encode($item['method'], \JSON_THROW_ON_ERROR)));
}

return $item;
Expand Down Expand Up @@ -262,7 +262,7 @@ private function getConditionalTreeBuilder(): Config\Definition\Builder\TreeBuil
->validate()
->ifNotInArray(array_keys(self::$endpoints))
->thenInvalid(
sprintf('The value should be one of [%s], got %%s', implode(', ', array_keys(self::$endpoints)))
\sprintf('The value should be one of [%s], got %%s', implode(', ', array_keys(self::$endpoints)))
)
->end()
->end()
Expand Down

0 comments on commit e0a290a

Please sign in to comment.