@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * @inheritdoc |
70 | 70 | */ |
71 | - public function parseParameters(?array $parameters): array |
|
71 | + public function parseParameters(? array $parameters) : array |
|
72 | 72 | { |
73 | 73 | if ($parameters === null) { |
74 | 74 | return [0, $this->getDefaultPageSize()]; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | 0, |
82 | 82 | PHP_INT_MAX |
83 | 83 | ); |
84 | - $size = $this->getValue( |
|
84 | + $size = $this->getValue( |
|
85 | 85 | $parameters, |
86 | 86 | static::PARAM_PAGING_SIZE, |
87 | 87 | $this->getDefaultPageSize(), |
@@ -208,12 +208,12 @@ |
||
208 | 208 | return [static::DATA => $data->getData()]; |
209 | 209 | } |
210 | 210 | |
211 | - $buildUrl = function ($offset) use ($data, $uri) { |
|
211 | + $buildUrl = function($offset) use ($data, $uri) { |
|
212 | 212 | $paramsWithPaging = [ |
213 | 213 | PaginationStrategyInterface::PARAM_PAGING_SKIP => $offset, |
214 | 214 | PaginationStrategyInterface::PARAM_PAGING_SIZE => $data->getLimit(), |
215 | 215 | ]; |
216 | - $fullUrl = $uri . '?' . http_build_query($paramsWithPaging); |
|
216 | + $fullUrl = $uri.'?'.http_build_query($paramsWithPaging); |
|
217 | 217 | |
218 | 218 | return $fullUrl; |
219 | 219 | }; |
@@ -108,8 +108,8 @@ |
||
108 | 108 | ); |
109 | 109 | assert(empty($validatorsFileMask) === false, "Invalid Validators file mask `$validatorsFileMask`."); |
110 | 110 | |
111 | - $schemesPath = $schemesFolder . DIRECTORY_SEPARATOR . $schemesFileMask; |
|
112 | - $validatorsPath = $validatorsFolder . DIRECTORY_SEPARATOR . $validatorsFileMask; |
|
111 | + $schemesPath = $schemesFolder.DIRECTORY_SEPARATOR.$schemesFileMask; |
|
112 | + $validatorsPath = $validatorsFolder.DIRECTORY_SEPARATOR.$validatorsFileMask; |
|
113 | 113 | |
114 | 114 | $requireUniqueTypes = $defaults[static::KEY_SCHEMES_REQUIRE_UNIQUE_TYPES] ?? true; |
115 | 115 |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | public function getMappedIncludes(): iterable |
246 | 246 | { |
247 | 247 | $fromScheme = $this->getRootScheme(); |
248 | - $getMappedRelLinks = function (iterable $links) use ($fromScheme) : iterable { |
|
248 | + $getMappedRelLinks = function(iterable $links) use ($fromScheme) : iterable { |
|
249 | 249 | foreach ($links as $link) { |
250 | 250 | assert(is_string($link)); |
251 | 251 | $fromSchemaClass = get_class($fromScheme); |
@@ -289,14 +289,14 @@ discard block |
||
289 | 289 | // ['rel2_name1', ], |
290 | 290 | // ['rel3_name1', 'rel3_name2', 'rel3_name3', ], |
291 | 291 | // ] |
292 | - $includeAsModelNames = function (iterable $relationships): iterable { |
|
292 | + $includeAsModelNames = function(iterable $relationships): iterable { |
|
293 | 293 | foreach ($relationships as $relationship) { |
294 | 294 | assert($relationship instanceof RelationshipInterface); |
295 | 295 | yield $relationship->getNameInModel(); |
296 | 296 | } |
297 | 297 | }; |
298 | - $mappedIncludes = $this->getMappedIncludes(); |
|
299 | - $getIncludes = function () use ($mappedIncludes, $includeAsModelNames) : iterable { |
|
298 | + $mappedIncludes = $this->getMappedIncludes(); |
|
299 | + $getIncludes = function() use ($mappedIncludes, $includeAsModelNames) : iterable { |
|
300 | 300 | foreach ($mappedIncludes as $relationships) { |
301 | 301 | yield $includeAsModelNames($relationships); |
302 | 302 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | public function __construct(array $parameters = [], array $messages = null) |
49 | 49 | { |
50 | 50 | $this->setParameters($parameters); |
51 | - $this->messages = $messages; |
|
51 | + $this->messages = $messages; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | public function getIncludes(): iterable |
70 | 70 | { |
71 | 71 | if (array_key_exists(static::PARAM_INCLUDE, $this->getParameters()) === true) { |
72 | - $splitByDot = function (string $path): iterable { |
|
72 | + $splitByDot = function(string $path): iterable { |
|
73 | 73 | foreach ($this->splitStringAndCheckNoEmpties(static::PARAM_INCLUDE, $path, '.') as $link) { |
74 | 74 | yield $link; |
75 | 75 | } |
76 | 76 | }; |
77 | 77 | |
78 | - $includes = $this->getParameters()[static::PARAM_INCLUDE]; |
|
78 | + $includes = $this->getParameters()[static::PARAM_INCLUDE]; |
|
79 | 79 | foreach ($this->splitCommaSeparatedStringAndCheckNoEmpties(static::PARAM_INCLUDE, $includes) as $path) { |
80 | 80 | yield $path => $splitByDot($path); |
81 | 81 | } |
@@ -49,22 +49,22 @@ discard block |
||
49 | 49 | |
50 | 50 | $container[FactoryInterface::class] = $factory; |
51 | 51 | |
52 | - $container[JsonSchemesInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
52 | + $container[JsonSchemesInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
53 | 53 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
54 | 54 | $modelSchemes = $container->get(ModelSchemeInfoInterface::class); |
55 | 55 | |
56 | 56 | return $factory->createJsonSchemes($settings[FluteSettings::KEY_MODEL_TO_SCHEME_MAP], $modelSchemes); |
57 | 57 | }; |
58 | 58 | |
59 | - $container[QueryParserInterface::class] = function (PsrContainerInterface $container) { |
|
59 | + $container[QueryParserInterface::class] = function(PsrContainerInterface $container) { |
|
60 | 60 | return new QueryParser($container->get(PaginationStrategyInterface::class)); |
61 | 61 | }; |
62 | 62 | |
63 | - $container[ParametersMapperInterface::class] = function (PsrContainerInterface $container) { |
|
63 | + $container[ParametersMapperInterface::class] = function(PsrContainerInterface $container) { |
|
64 | 64 | return new ParametersMapper($container->get(JsonSchemesInterface::class)); |
65 | 65 | }; |
66 | 66 | |
67 | - $container[EncoderInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
67 | + $container[EncoderInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
68 | 68 | /** @var JsonSchemesInterface $jsonSchemes */ |
69 | 69 | $jsonSchemes = $container->get(JsonSchemesInterface::class); |
70 | 70 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return $encoder; |
80 | 80 | }; |
81 | 81 | |
82 | - $container[PaginationStrategyInterface::class] = function (PsrContainerInterface $container) { |
|
82 | + $container[PaginationStrategyInterface::class] = function(PsrContainerInterface $container) { |
|
83 | 83 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
84 | 84 | |
85 | 85 | return new PaginationStrategy( |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ); |
89 | 89 | }; |
90 | 90 | |
91 | - $container[JsonApiValidatorFactoryInterface::class] = function (PsrContainerInterface $container) { |
|
91 | + $container[JsonApiValidatorFactoryInterface::class] = function(PsrContainerInterface $container) { |
|
92 | 92 | $factory = new JsonApiValidatorFactory($container); |
93 | 93 | |
94 | 94 | return $factory; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public static function configureExceptionHandler(LimoncelloContainerInterface $container) |
118 | 118 | { |
119 | - $container[ThrowableHandlerInterface::class] = function (PsrContainerInterface $container) { |
|
119 | + $container[ThrowableHandlerInterface::class] = function(PsrContainerInterface $container) { |
|
120 | 120 | $appSettings = $container->get(SettingsProviderInterface::class)->get(A::class); |
121 | 121 | $fluteSettings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
122 | 122 |
@@ -121,7 +121,7 @@ |
||
121 | 121 | * |
122 | 122 | * @return array|null |
123 | 123 | */ |
124 | - public function fetchRow(QueryBuilder $builder, string $modelClass): ?array; |
|
124 | + public function fetchRow(QueryBuilder $builder, string $modelClass): ? array; |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * @param QueryBuilder $builder |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | string $relationshipName, |
290 | 290 | iterable $relationshipFilters, |
291 | 291 | ?iterable $relationshipSorts |
292 | - ): self { |
|
292 | + ) : self { |
|
293 | 293 | $joinWith = $this->expr()->andX(); |
294 | 294 | |
295 | 295 | return $this->addRelationshipFiltersAndSorts( |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | string $relationshipName, |
324 | 324 | iterable $relationshipFilters, |
325 | 325 | ?iterable $relationshipSorts |
326 | - ): self { |
|
326 | + ) : self { |
|
327 | 327 | $joinWith = $this->expr()->orX(); |
328 | 328 | |
329 | 329 | return $this->addRelationshipFiltersAndSorts( |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | CompositeExpression $filterLink, |
387 | 387 | iterable $relationshipFilters, |
388 | 388 | ?iterable $relationshipSorts |
389 | - ): self { |
|
389 | + ) : self { |
|
390 | 390 | $relationshipType = $this->getModelSchemes()->getRelationshipType($this->getModelClass(), $relationshipName); |
391 | 391 | switch ($relationshipType) { |
392 | 392 | case RelationshipTypes::BELONGS_TO: |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | CompositeExpression $filterLink, |
460 | 460 | iterable $relationshipFilters, |
461 | 461 | ?iterable $relationshipSorts |
462 | - ): self { |
|
462 | + ) : self { |
|
463 | 463 | $foreignKey = $this->getModelSchemes()->getForeignKey($this->getModelClass(), $relationshipName); |
464 | 464 | list($onePrimaryKey, $oneTable) = |
465 | 465 | $this->getModelSchemes()->getReversePrimaryKey($this->getModelClass(), $relationshipName); |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | CompositeExpression $filterLink, |
492 | 492 | iterable $relationshipFilters, |
493 | 493 | ?iterable $relationshipSorts |
494 | - ): self { |
|
494 | + ) : self { |
|
495 | 495 | $primaryKey = $this->getModelSchemes()->getPrimaryKey($this->getModelClass()); |
496 | 496 | list($manyForeignKey, $manyTable) = |
497 | 497 | $this->getModelSchemes()->getReverseForeignKey($this->getModelClass(), $relationshipName); |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | CompositeExpression $targetFilterLink, |
524 | 524 | iterable $relationshipFilters, |
525 | 525 | ?iterable $relationshipSorts |
526 | - ): self { |
|
526 | + ) : self { |
|
527 | 527 | $primaryKey = $this->getModelSchemes()->getPrimaryKey($this->getModelClass()); |
528 | 528 | list ($intermediateTable, $intermediatePk, $intermediateFk) = |
529 | 529 | $this->getModelSchemes()->getBelongsToManyRelationship($this->getModelClass(), $relationshipName); |
@@ -571,9 +571,9 @@ discard block |
||
571 | 571 | ?CompositeExpression $targetFilterLink, |
572 | 572 | ?iterable $targetFilterParams, |
573 | 573 | ?iterable $relationshipSorts |
574 | - ): string { |
|
574 | + ) : string { |
|
575 | 575 | $targetAlias = $this->createAlias($targetTable); |
576 | - $joinCondition = $this->buildColumnName($fromAlias, $fromColumn) . '=' . |
|
576 | + $joinCondition = $this->buildColumnName($fromAlias, $fromColumn).'='. |
|
577 | 577 | $this->buildColumnName($targetAlias, $targetColumn); |
578 | 578 | |
579 | 579 | $this->innerJoin( |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | ?CompositeExpression $targetFilterLink, |
633 | 633 | ?iterable $targetFilterParams, |
634 | 634 | ?iterable $targetSortParams |
635 | - ): string { |
|
635 | + ) : string { |
|
636 | 636 | $intNoSorting = null; |
637 | 637 | $intAlias = $this->innerJoinOneTable( |
638 | 638 | $fromAlias, |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | $intFilterParams, |
644 | 644 | $intNoSorting |
645 | 645 | ); |
646 | - $targetAlias = $this->innerJoinOneTable( |
|
646 | + $targetAlias = $this->innerJoinOneTable( |
|
647 | 647 | $intAlias, |
648 | 648 | $intToTargetColumn, |
649 | 649 | $targetTable, |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | */ |
664 | 664 | private function createAlias(string $tableName): string |
665 | 665 | { |
666 | - $alias = $tableName . (++$this->aliasIdCounter); |
|
666 | + $alias = $tableName.(++$this->aliasIdCounter); |
|
667 | 667 | $this->knownAliases[$tableName] = $alias; |
668 | 668 | |
669 | 669 | return $alias; |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | } else { |
828 | 828 | assert( |
829 | 829 | $value !== null, |
830 | - 'It seems you are trying to use `null` with =, >, <, or etc operator. ' . |
|
830 | + 'It seems you are trying to use `null` with =, >, <, or etc operator. '. |
|
831 | 831 | 'Use `is null` or `not null` instead.' |
832 | 832 | ); |
833 | 833 | assert(is_string($value), "Only strings, booleans and integers are supported."); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | protected static function readJsonFromRequest(ContainerInterface $container, ServerRequestInterface $request): array |
242 | 242 | { |
243 | - $body = (string)$request->getBody(); |
|
243 | + $body = (string) $request->getBody(); |
|
244 | 244 | if (empty($body) === true || ($json = json_decode($body, true)) === null) { |
245 | 245 | /** @var FactoryInterface $factory */ |
246 | 246 | $factory = $container->get(FactoryInterface::class); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | { |
384 | 384 | assert( |
385 | 385 | empty(static::ON_CREATE_VALIDATION_RULES_SET_CLASS) === false, |
386 | - 'Validation rules set should be defined for class ' . static::class . '.' |
|
386 | + 'Validation rules set should be defined for class '.static::class.'.' |
|
387 | 387 | ); |
388 | 388 | |
389 | 389 | return static::createJsonApiValidator($container, static::ON_CREATE_VALIDATION_RULES_SET_CLASS); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | { |
399 | 399 | assert( |
400 | 400 | empty(static::ON_UPDATE_VALIDATION_RULES_SET_CLASS) === false, |
401 | - 'Validation rules set should be defined for class ' . static::class . '.' |
|
401 | + 'Validation rules set should be defined for class '.static::class.'.' |
|
402 | 402 | ); |
403 | 403 | |
404 | 404 | return static::createJsonApiValidator($container, static::ON_UPDATE_VALIDATION_RULES_SET_CLASS); |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | ContainerInterface $container, |
607 | 607 | ServerRequestInterface $request |
608 | 608 | ): array { |
609 | - $jsonData = static::normalizeIndexValueOnUpdate( |
|
609 | + $jsonData = static::normalizeIndexValueOnUpdate( |
|
610 | 610 | $routeParams, |
611 | 611 | $container, |
612 | 612 | static::readJsonFromRequest($container, $request) |