@@ -101,8 +101,7 @@ |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | $reply = $count > 0 ? |
104 | - BlockReplies::createSuccessReply($value) : |
|
105 | - BlockReplies::createErrorReply($context, $value, ErrorCodes::EXIST_IN_DATABASE_SINGLE); |
|
104 | + BlockReplies::createSuccessReply($value) : BlockReplies::createErrorReply($context, $value, ErrorCodes::EXIST_IN_DATABASE_SINGLE); |
|
106 | 105 | |
107 | 106 | return $reply; |
108 | 107 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $pkColumn = $this->buildColumnName($table, $pkName); |
222 | 222 | $type = Type::getType($types[$pkName]); |
223 | 223 | $pdoValue = $type->convertToDatabaseValue($index, $dbPlatform); |
224 | - $builder->where($pkColumn . '=' . $builder->createNamedParameter($pdoValue, $type->getBindingType())); |
|
224 | + $builder->where($pkColumn.'='.$builder->createNamedParameter($pdoValue, $type->getBindingType())); |
|
225 | 225 | |
226 | 226 | return $builder; |
227 | 227 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | foreach ($filterValue as $operation => $params) { |
352 | 352 | $filterTable = null; |
353 | 353 | $filterColumn = null; |
354 | - $lcOp = strtolower((string)$operation); |
|
354 | + $lcOp = strtolower((string) $operation); |
|
355 | 355 | |
356 | 356 | if ($filterParam->isForRelationship() === true) { |
357 | 357 | switch ($filterParam->getRelationshipType()) { |
@@ -366,8 +366,8 @@ discard block |
||
366 | 366 | $reversePk = $modelSchemes->getPrimaryKey($reverseClass); |
367 | 367 | $filterTable = $modelSchemes->getTable($reverseClass); |
368 | 368 | $filterColumn = $filterParam->getAttributeName(); |
369 | - $aliased = $filterTable . $this->getNewAliasId(); |
|
370 | - $joinCondition = $this->buildColumnName($table, $foreignKey) . '=' . |
|
369 | + $aliased = $filterTable.$this->getNewAliasId(); |
|
370 | + $joinCondition = $this->buildColumnName($table, $foreignKey).'='. |
|
371 | 371 | $this->buildColumnName($aliased, $reversePk); |
372 | 372 | $builder->innerJoin( |
373 | 373 | $quotedTable, |
@@ -397,8 +397,8 @@ discard block |
||
397 | 397 | $reverseFk = $modelSchemes->getForeignKey($reverseClass, $reverseName); |
398 | 398 | $filterColumn = $filterParam->isForAttributeInRelationship() === true ? |
399 | 399 | $filterParam->getAttributeName() : $modelSchemes->getPrimaryKey($reverseClass); |
400 | - $aliased = $filterTable . $this->getNewAliasId(); |
|
401 | - $joinCondition = $this->buildColumnName($table, $primaryKey) . '=' . |
|
400 | + $aliased = $filterTable.$this->getNewAliasId(); |
|
401 | + $joinCondition = $this->buildColumnName($table, $primaryKey).'='. |
|
402 | 402 | $this->buildColumnName($aliased, $reverseFk); |
403 | 403 | $builder->innerJoin( |
404 | 404 | $quotedTable, |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | list ($intermediateTable, $intermediatePk, $intermediateFk) = $modelSchemes |
418 | 418 | ->getBelongsToManyRelationship($modelClass, $filterParam->getRelationshipName()); |
419 | 419 | $primaryKey = $modelSchemes->getPrimaryKey($modelClass); |
420 | - $aliased = $intermediateTable . $this->getNewAliasId(); |
|
421 | - $joinCondition = $this->buildColumnName($table, $primaryKey) . '=' . |
|
420 | + $aliased = $intermediateTable.$this->getNewAliasId(); |
|
421 | + $joinCondition = $this->buildColumnName($table, $primaryKey).'='. |
|
422 | 422 | $this->buildColumnName($aliased, $intermediatePk); |
423 | 423 | $builder->innerJoin( |
424 | 424 | $quotedTable, |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | $reverseTable = $modelSchemes->getTable($reverseClass); |
442 | 442 | $reversePk = $modelSchemes->getPrimaryKey($reverseClass); |
443 | 443 | // now join the table with intermediate |
444 | - $aliased2 = $reverseTable . $this->getNewAliasId(); |
|
445 | - $joinCondition = $this->buildColumnName($aliased, $intermediateFk) . |
|
446 | - '=' . $this->buildColumnName($aliased2, $reversePk); |
|
444 | + $aliased2 = $reverseTable.$this->getNewAliasId(); |
|
445 | + $joinCondition = $this->buildColumnName($aliased, $intermediateFk). |
|
446 | + '='.$this->buildColumnName($aliased2, $reversePk); |
|
447 | 447 | $builder->innerJoin( |
448 | 448 | $aliased, |
449 | 449 | $this->buildTableName($reverseTable), |
@@ -668,11 +668,11 @@ discard block |
||
668 | 668 | break; |
669 | 669 | case 'in': |
670 | 670 | $this->getFilterOperations() |
671 | - ->applyIn($builder, $link, $errors, $table, $field, (array)$params); |
|
671 | + ->applyIn($builder, $link, $errors, $table, $field, (array) $params); |
|
672 | 672 | break; |
673 | 673 | case 'not-in': |
674 | 674 | $this->getFilterOperations() |
675 | - ->applyNotIn($builder, $link, $errors, $table, $field, (array)$params); |
|
675 | + ->applyNotIn($builder, $link, $errors, $table, $field, (array) $params); |
|
676 | 676 | break; |
677 | 677 | case self::FILTER_OP_IS_NULL: |
678 | 678 | $this->getFilterOperations()->applyIsNull($builder, $link, $table, $field); |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | private function addWhereBind(QueryBuilder $builder, string $table, string $column, string $bindName): void |
715 | 715 | { |
716 | 716 | $builder |
717 | - ->andWhere($this->buildColumnName($table, $column) . '=' . $bindName); |
|
717 | + ->andWhere($this->buildColumnName($table, $column).'='.$bindName); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | /** |
@@ -734,8 +734,8 @@ discard block |
||
734 | 734 | |
735 | 735 | $builder = $this->getConnection()->createQueryBuilder(); |
736 | 736 | |
737 | - $aliased = $table . $this->getNewAliasId(); |
|
738 | - $joinCondition = $this->buildColumnName($oneTable, $onePrimaryKey) . '=' . |
|
737 | + $aliased = $table.$this->getNewAliasId(); |
|
738 | + $joinCondition = $this->buildColumnName($oneTable, $onePrimaryKey).'='. |
|
739 | 739 | $this->buildColumnName($aliased, $foreignKey); |
740 | 740 | $builder |
741 | 741 | ->select($this->getColumns($oneClass)) |
@@ -780,8 +780,8 @@ discard block |
||
780 | 780 | $reverseTableQuoted = $this->buildTableName($reverseTable); |
781 | 781 | $reversePk = $this->getModelSchemes()->getPrimaryKey($reverseClass); |
782 | 782 | |
783 | - $aliased = $intermediateTable . $this->getNewAliasId(); |
|
784 | - $joinCondition = $this->buildColumnName($reverseTable, $reversePk) . '=' . |
|
783 | + $aliased = $intermediateTable.$this->getNewAliasId(); |
|
784 | + $joinCondition = $this->buildColumnName($reverseTable, $reversePk).'='. |
|
785 | 785 | $this->buildColumnName($aliased, $reverseForeignKey); |
786 | 786 | $builder = $this->getConnection()->createQueryBuilder(); |
787 | 787 | $builder |
@@ -180,10 +180,9 @@ discard block |
||
180 | 180 | |
181 | 181 | $placeholders = null; |
182 | 182 | foreach ($values as $value) { |
183 | - $placeholders[] = $builder->createNamedParameter((string)$value); |
|
183 | + $placeholders[] = $builder->createNamedParameter((string) $value); |
|
184 | 184 | } |
185 | - $placeholders === null ?: |
|
186 | - $link->add($builder->expr()->in($this->getTableColumn($table, $column), $placeholders)); |
|
185 | + $placeholders === null ?: $link->add($builder->expr()->in($this->getTableColumn($table, $column), $placeholders)); |
|
187 | 186 | } |
188 | 187 | |
189 | 188 | /** |
@@ -205,10 +204,9 @@ discard block |
||
205 | 204 | |
206 | 205 | $placeholders = null; |
207 | 206 | foreach ($values as $value) { |
208 | - $placeholders[] = $builder->createNamedParameter((string)$value); |
|
207 | + $placeholders[] = $builder->createNamedParameter((string) $value); |
|
209 | 208 | } |
210 | - $placeholders === null ?: |
|
211 | - $link->add($builder->expr()->notIn($this->getTableColumn($table, $column), $placeholders)); |
|
209 | + $placeholders === null ?: $link->add($builder->expr()->notIn($this->getTableColumn($table, $column), $placeholders)); |
|
212 | 210 | } |
213 | 211 | |
214 | 212 | /** |
@@ -258,14 +256,14 @@ discard block |
||
258 | 256 | if (is_array($params) === true) { |
259 | 257 | foreach ($params as $param) { |
260 | 258 | if (is_scalar($param) === true) { |
261 | - $param = (string)$builder->createNamedParameter($param); |
|
259 | + $param = (string) $builder->createNamedParameter($param); |
|
262 | 260 | $link->add($builder->expr()->{$method}($this->getTableColumn($table, $column), $param)); |
263 | 261 | } else { |
264 | 262 | $this->addInvalidQueryParameterError($errors, $column); |
265 | 263 | } |
266 | 264 | } |
267 | 265 | } elseif (is_scalar($params) === true) { |
268 | - $param = $builder->createNamedParameter((string)$params); |
|
266 | + $param = $builder->createNamedParameter((string) $params); |
|
269 | 267 | $link->add($builder->expr()->{$method}($this->getTableColumn($table, $column), $param)); |
270 | 268 | } else { |
271 | 269 | // parameter is neither array nor string/scalar |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * |
175 | 175 | * @return null|SortParameterInterface[] |
176 | 176 | */ |
177 | - protected function mapSortParameters(ErrorCollection $errors, array $parameters = null): ?array |
|
177 | + protected function mapSortParameters(ErrorCollection $errors, array $parameters = null): ? array |
|
178 | 178 | { |
179 | 179 | $sorts = null; |
180 | 180 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return null|IncludeParameterInterface[] |
201 | 201 | */ |
202 | - protected function mapIncludeParameters(ErrorCollection $errors, array $parameters = null): ?array |
|
202 | + protected function mapIncludeParameters(ErrorCollection $errors, array $parameters = null): ? array |
|
203 | 203 | { |
204 | 204 | $includes = null; |
205 | 205 |
@@ -124,7 +124,7 @@ |
||
124 | 124 | * |
125 | 125 | * @return array|null |
126 | 126 | */ |
127 | - public function readRow($index): ?array; |
|
127 | + public function readRow($index): ? array; |
|
128 | 128 | |
129 | 129 | /** |
130 | 130 | * @param FilterParameterCollection|null $filterParams |
@@ -162,7 +162,7 @@ |
||
162 | 162 | protected function setWrapperErrors(array $wrapperErrors): self |
163 | 163 | { |
164 | 164 | if (empty($wrapperErrors) === false) { |
165 | - assert(call_user_func(function () use ($wrapperErrors) : bool { |
|
165 | + assert(call_user_func(function() use ($wrapperErrors) : bool { |
|
166 | 166 | $allAreErrors = true; |
167 | 167 | |
168 | 168 | foreach ($wrapperErrors as $error) { |
@@ -52,18 +52,18 @@ discard block |
||
52 | 52 | |
53 | 53 | $container[FactoryInterface::class] = $factory; |
54 | 54 | |
55 | - $container[QueryParametersParserInterface::class] = function () use ($factory) { |
|
55 | + $container[QueryParametersParserInterface::class] = function() use ($factory) { |
|
56 | 56 | return $factory->getJsonApiFactory()->createQueryParametersParser(); |
57 | 57 | }; |
58 | 58 | |
59 | - $container[JsonSchemesInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
59 | + $container[JsonSchemesInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
60 | 60 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
61 | 61 | $modelSchemes = $container->get(ModelSchemeInfoInterface::class); |
62 | 62 | |
63 | 63 | return $factory->createJsonSchemes($settings[FluteSettings::KEY_MODEL_TO_SCHEME_MAP], $modelSchemes); |
64 | 64 | }; |
65 | 65 | |
66 | - $container[EncoderInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
66 | + $container[EncoderInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
67 | 67 | /** @var JsonSchemesInterface $jsonSchemes */ |
68 | 68 | $jsonSchemes = $container->get(JsonSchemesInterface::class); |
69 | 69 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | return $encoder; |
79 | 79 | }; |
80 | 80 | |
81 | - $container[FilterOperationsInterface::class] = function (PsrContainerInterface $container) { |
|
81 | + $container[FilterOperationsInterface::class] = function(PsrContainerInterface $container) { |
|
82 | 82 | return new FilterOperations($container); |
83 | 83 | }; |
84 | 84 | |
85 | - $container[RepositoryInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
85 | + $container[RepositoryInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
86 | 86 | $connection = $container->get(Connection::class); |
87 | 87 | /** @var ModelSchemeInfoInterface $modelSchemes */ |
88 | 88 | $modelSchemes = $container->get(ModelSchemeInfoInterface::class); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | return $factory->createRepository($connection, $modelSchemes, $filerOps, $formatter); |
98 | 98 | }; |
99 | 99 | |
100 | - $container[PaginationStrategyInterface::class] = function (PsrContainerInterface $container) { |
|
100 | + $container[PaginationStrategyInterface::class] = function(PsrContainerInterface $container) { |
|
101 | 101 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
102 | 102 | |
103 | 103 | return new PaginationStrategy( |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | ); |
107 | 107 | }; |
108 | 108 | |
109 | - $container[JsonApiValidatorFactoryInterface::class] = function (PsrContainerInterface $container) { |
|
109 | + $container[JsonApiValidatorFactoryInterface::class] = function(PsrContainerInterface $container) { |
|
110 | 110 | $factory = new JsonApiValidatorFactory($container); |
111 | 111 | |
112 | 112 | return $factory; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public static function configureExceptionHandler(LimoncelloContainerInterface $container) |
136 | 136 | { |
137 | - $container[ThrowableHandlerInterface::class] = function (PsrContainerInterface $container) { |
|
137 | + $container[ThrowableHandlerInterface::class] = function(PsrContainerInterface $container) { |
|
138 | 138 | $appSettings = $container->get(SettingsProviderInterface::class)->get(A::class); |
139 | 139 | $fluteSettings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
140 | 140 |
@@ -99,7 +99,7 @@ |
||
99 | 99 | $details = null; |
100 | 100 | if ($this->isDebug === true) { |
101 | 101 | $message = $throwable->getMessage(); |
102 | - $details = (string)$throwable; |
|
102 | + $details = (string) $throwable; |
|
103 | 103 | } |
104 | 104 | $errors->add(new Error(null, null, $httpCode, null, $message, $details)); |
105 | 105 | } |
@@ -865,8 +865,8 @@ |
||
865 | 865 | |
866 | 866 | /** |
867 | 867 | * @param array $models |
868 | - * @param int|string|null $offset |
|
869 | - * @param int|string|null $limit |
|
868 | + * @param integer $offset |
|
869 | + * @param integer $limit |
|
870 | 870 | * |
871 | 871 | * @return array |
872 | 872 | * |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | /** |
285 | 285 | * @inheritdoc |
286 | 286 | */ |
287 | - public function readRow($index): ?array |
|
287 | + public function readRow($index): ? array |
|
288 | 288 | { |
289 | 289 | if ($index !== null && is_scalar($index) === false) { |
290 | 290 | throw new InvalidArgumentException($this->getMessage(Messages::MSG_ERR_INVALID_ARGUMENT)); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | |
317 | 317 | $deleted = $builder->execute(); |
318 | 318 | |
319 | - return (int)$deleted; |
|
319 | + return (int) $deleted; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $saveMain = $this->getRepository()->create($modelClass, $allowedChanges); |
336 | 336 | $saveMain = $this->builderSaveResourceOnCreate($saveMain); |
337 | 337 | $saveMain->getSQL(); // prepare |
338 | - $this->inTransaction(function () use ($modelClass, $saveMain, $toMany, &$index) { |
|
338 | + $this->inTransaction(function() use ($modelClass, $saveMain, $toMany, &$index) { |
|
339 | 339 | $saveMain->execute(); |
340 | 340 | // if no index given will use last insert ID as index |
341 | 341 | $index !== null ?: $index = $saveMain->getConnection()->lastInsertId(); |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $saveMain = $this->getRepository()->update($modelClass, $index, $allowedChanges); |
373 | 373 | $saveMain = $this->builderSaveResourceOnUpdate($saveMain); |
374 | 374 | $saveMain->getSQL(); // prepare |
375 | - $this->inTransaction(function () use ($modelClass, $saveMain, $toMany, $index, &$updated) { |
|
375 | + $this->inTransaction(function() use ($modelClass, $saveMain, $toMany, $index, &$updated) { |
|
376 | 376 | $updated = $saveMain->execute(); |
377 | 377 | foreach ($toMany as $name => $values) { |
378 | 378 | $indexBind = ':index'; |
@@ -387,12 +387,12 @@ discard block |
||
387 | 387 | $saveToMany = $this->builderSaveRelationshipOnUpdate($name, $saveToMany); |
388 | 388 | $saveToMany->setParameter($indexBind, $index); |
389 | 389 | foreach ($values as $value) { |
390 | - $updated += (int)$saveToMany->setParameter($otherIndexBind, $value)->execute(); |
|
390 | + $updated += (int) $saveToMany->setParameter($otherIndexBind, $value)->execute(); |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | }); |
394 | 394 | |
395 | - return (int)$updated; |
|
395 | + return (int) $updated; |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | /** |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * |
492 | 492 | * @return array|null |
493 | 493 | */ |
494 | - protected function fetchRow(QueryBuilder $builder, string $class): ?array |
|
494 | + protected function fetchRow(QueryBuilder $builder, string $class): ? array |
|
495 | 495 | { |
496 | 496 | $statement = $builder->execute(); |
497 | 497 | $statement->setFetchMode(PDOConnection::FETCH_ASSOC); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * |
705 | 705 | * @SuppressWarnings(PHPMD.ElseExpression) |
706 | 706 | */ |
707 | - protected function loadRelationships(PaginatedDataInterface $data, ?array $paths): void |
|
707 | + protected function loadRelationships(PaginatedDataInterface $data, ? array $paths) : void |
|
708 | 708 | { |
709 | 709 | if (empty($data->getData()) === false && empty($paths) === false) { |
710 | 710 | $modelStorage = $this->getFactory()->createModelStorage($this->getModelSchemes()); |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | foreach ($path->getPath() as $pathPiece) { |
763 | 763 | $parent = $tmpPath; |
764 | 764 | $tmpPath = empty($tmpPath) === true ? |
765 | - $pathPiece : $tmpPath . static::PATH_SEPARATOR . $pathPiece; |
|
765 | + $pathPiece : $tmpPath.static::PATH_SEPARATOR.$pathPiece; |
|
766 | 766 | $normalizedPaths[$tmpPath] = [$parent, $pathPiece]; |
767 | 767 | $pathsDepths[$parent] = $parentDepth++; |
768 | 768 | } |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | // $models. |
812 | 812 | |
813 | 813 | foreach ($childRelationships as $name) { |
814 | - $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath . static::PATH_SEPARATOR . $name : $name; |
|
814 | + $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath.static::PATH_SEPARATOR.$name : $name; |
|
815 | 815 | |
816 | 816 | /** @var QueryBuilder $builder */ |
817 | 817 | list ($builder, $class, $relationshipType) = |