@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare (strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace Limoncello\Flute\Api; |
4 | 4 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | throw new InvalidArgumentException($this->getMessage(Messages::MSG_ERR_INVALID_ARGUMENT)); |
210 | 210 | } |
211 | 211 | |
212 | - assert(call_user_func(function () use ($indexes) { |
|
212 | + assert(call_user_func(function() use ($indexes) { |
|
213 | 213 | $allOk = true; |
214 | 214 | |
215 | 215 | foreach ($indexes as $index) { |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | $classAtPath = new ArrayObject(); |
764 | 764 | $idsAtPath = new ArrayObject(); |
765 | 765 | |
766 | - $registerModelAtRoot = function ($model) use ($modelStorage, $modelsAtPath, $idsAtPath): void { |
|
766 | + $registerModelAtRoot = function($model) use ($modelStorage, $modelsAtPath, $idsAtPath): void { |
|
767 | 767 | self::registerModelAtPath( |
768 | 768 | $model, |
769 | 769 | static::ROOT_PATH, |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | assert(is_string($pathPiece)); |
852 | 852 | $parent = $tmpPath; |
853 | 853 | $tmpPath = empty($tmpPath) === true ? |
854 | - $pathPiece : $tmpPath . static::PATH_SEPARATOR . $pathPiece; |
|
854 | + $pathPiece : $tmpPath.static::PATH_SEPARATOR.$pathPiece; |
|
855 | 855 | $normalizedPaths[$tmpPath] = [$parent, $pathPiece]; |
856 | 856 | $pathsDepths[$parent] = $parentDepth++; |
857 | 857 | } |
@@ -999,7 +999,7 @@ discard block |
||
999 | 999 | $this->createCountBuilderFromBuilder($this->createIndexModelBuilder()) |
1000 | 1000 | )->execute()->fetchColumn(); |
1001 | 1001 | |
1002 | - return $result === false ? null : (int)$result; |
|
1002 | + return $result === false ? null : (int) $result; |
|
1003 | 1003 | } |
1004 | 1004 | |
1005 | 1005 | /** |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | ): ModelQueryBuilder { |
1021 | 1021 | assert( |
1022 | 1022 | $this->getModelSchemas()->hasRelationship($this->getModelClass(), $relationshipName), |
1023 | - "Relationship `$relationshipName` do not exist in model `" . $this->getModelClass() . '`' |
|
1023 | + "Relationship `$relationshipName` do not exist in model `".$this->getModelClass().'`' |
|
1024 | 1024 | ); |
1025 | 1025 | |
1026 | 1026 | // as we read data from a relationship our main table and model would be the table/model in the relationship |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | if ($this->hasFilters() === true) { |
1039 | 1039 | $filters = $this->getFilters(); |
1040 | 1040 | $sorts = $this->getSorts(); |
1041 | - $joinCondition = $this->areFiltersWithAnd() === true ? ModelQueryBuilder::AND : ModelQueryBuilder::OR; |
|
1041 | + $joinCondition = $this->areFiltersWithAnd() === true ? ModelQueryBuilder:: AND : ModelQueryBuilder:: OR ; |
|
1042 | 1042 | $builder->addRelationshipFiltersAndSorts($reverseRelName, $filters, $sorts, $joinCondition); |
1043 | 1043 | } |
1044 | 1044 | // ... and the input filters to actual data we select |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | ) { |
1070 | 1070 | assert( |
1071 | 1071 | $this->getModelSchemas()->hasRelationship($this->getModelClass(), $name), |
1072 | - "Relationship `$name` do not exist in model `" . $this->getModelClass() . '`' |
|
1072 | + "Relationship `$name` do not exist in model `".$this->getModelClass().'`' |
|
1073 | 1073 | ); |
1074 | 1074 | |
1075 | 1075 | // depending on the relationship type we expect the result to be either single resource or a collection |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | ): array { |
1099 | 1099 | assert( |
1100 | 1100 | $this->getModelSchemas()->hasRelationship($this->getModelClass(), $name), |
1101 | - "Relationship `$name` do not exist in model `" . $this->getModelClass() . '`' |
|
1101 | + "Relationship `$name` do not exist in model `".$this->getModelClass().'`' |
|
1102 | 1102 | ); |
1103 | 1103 | |
1104 | 1104 | // depending on the relationship type we expect the result to be either single resource or a collection |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | |
1168 | 1168 | $this->clearFetchParameters(); |
1169 | 1169 | |
1170 | - return (int)$deleted; |
|
1170 | + return (int) $deleted; |
|
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | /** |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | $this->clearFetchParameters(); |
1185 | 1185 | |
1186 | - return (int)$deleted > 0; |
|
1186 | + return (int) $deleted > 0; |
|
1187 | 1187 | } |
1188 | 1188 | |
1189 | 1189 | /** |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | |
1205 | 1205 | $this->clearBuilderParameters()->clearFetchParameters(); |
1206 | 1206 | |
1207 | - $this->inTransaction(function () use ($saveMain, $toMany, &$index) { |
|
1207 | + $this->inTransaction(function() use ($saveMain, $toMany, &$index) { |
|
1208 | 1208 | $saveMain->execute(); |
1209 | 1209 | |
1210 | 1210 | // if no index given will use last insert ID as index |
@@ -1241,12 +1241,12 @@ discard block |
||
1241 | 1241 | ->createBuilder($this->getModelClass()) |
1242 | 1242 | ->updateModels($allowedChanges) |
1243 | 1243 | ->addFiltersWithAndToTable($filters); |
1244 | - $saveMain = $this->builderSaveResourceOnUpdate($saveMain); |
|
1244 | + $saveMain = $this->builderSaveResourceOnUpdate($saveMain); |
|
1245 | 1245 | $saveMain->getSQL(); // prepare |
1246 | 1246 | |
1247 | 1247 | $this->clearBuilderParameters()->clearFetchParameters(); |
1248 | 1248 | |
1249 | - $this->inTransaction(function () use ($saveMain, $toMany, $index, &$updated) { |
|
1249 | + $this->inTransaction(function() use ($saveMain, $toMany, $index, &$updated) { |
|
1250 | 1250 | $updated = $saveMain->execute(); |
1251 | 1251 | |
1252 | 1252 | $builderHook = Closure::fromCallable([$this, 'builderSaveRelationshipOnUpdate']); |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | )->execute(); |
1263 | 1263 | |
1264 | 1264 | // add new ones |
1265 | - $updated += $this->addInToManyRelationship( |
|
1265 | + $updated += $this->addInToManyRelationship( |
|
1266 | 1266 | $connection, |
1267 | 1267 | $index, |
1268 | 1268 | $relationshipName, |
@@ -1272,7 +1272,7 @@ discard block |
||
1272 | 1272 | } |
1273 | 1273 | }); |
1274 | 1274 | |
1275 | - return (int)$updated; |
|
1275 | + return (int) $updated; |
|
1276 | 1276 | } |
1277 | 1277 | |
1278 | 1278 | /** |
@@ -1289,9 +1289,9 @@ discard block |
||
1289 | 1289 | public function createInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int |
1290 | 1290 | { |
1291 | 1291 | // Check that relationship is `BelongsToMany` |
1292 | - assert(call_user_func(function () use ($name): bool { |
|
1292 | + assert(call_user_func(function() use ($name): bool { |
|
1293 | 1293 | $relType = $this->getModelSchemas()->getRelationshipType($this->getModelClass(), $name); |
1294 | - $errMsg = "Relationship `$name` of class `" . $this->getModelClass() . |
|
1294 | + $errMsg = "Relationship `$name` of class `".$this->getModelClass(). |
|
1295 | 1295 | '` either is not `belongsToMany` or do not exist in the class.'; |
1296 | 1296 | $isOk = $relType === RelationshipTypes::BELONGS_TO_MANY; |
1297 | 1297 | |
@@ -1313,9 +1313,9 @@ discard block |
||
1313 | 1313 | public function removeInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int |
1314 | 1314 | { |
1315 | 1315 | // Check that relationship is `BelongsToMany` |
1316 | - assert(call_user_func(function () use ($name): bool { |
|
1316 | + assert(call_user_func(function() use ($name): bool { |
|
1317 | 1317 | $relType = $this->getModelSchemas()->getRelationshipType($this->getModelClass(), $name); |
1318 | - $errMsg = "Relationship `$name` of class `" . $this->getModelClass() . |
|
1318 | + $errMsg = "Relationship `$name` of class `".$this->getModelClass(). |
|
1319 | 1319 | '` either is not `belongsToMany` or do not exist in the class.'; |
1320 | 1320 | $isOk = $relType === RelationshipTypes::BELONGS_TO_MANY; |
1321 | 1321 | |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | { |
1484 | 1484 | $countBuilder = $this->createBuilder($this->getModelClass()); |
1485 | 1485 | $countBuilder->setParameters($builder->getParameters()); |
1486 | - $countBuilder->select('COUNT(*)')->from('(' . $builder->getSQL() . ') AS RESULT'); |
|
1486 | + $countBuilder->select('COUNT(*)')->from('('.$builder->getSQL().') AS RESULT'); |
|
1487 | 1487 | |
1488 | 1488 | return $countBuilder; |
1489 | 1489 | } |
@@ -1517,7 +1517,7 @@ discard block |
||
1517 | 1517 | |
1518 | 1518 | foreach ($secondaryIdentities as $secondaryId) { |
1519 | 1519 | try { |
1520 | - $inserted += (int)$saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute(); |
|
1520 | + $inserted += (int) $saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute(); |
|
1521 | 1521 | } /** @noinspection PhpRedundantCatchClauseInspection */ catch (UcvException $exception) { |
1522 | 1522 | // Spec: If all of the specified resources can be added to, or are already present in, |
1523 | 1523 | // the relationship then the server MUST return a successful response. |
@@ -1764,7 +1764,7 @@ discard block |
||
1764 | 1764 | |
1765 | 1765 | $pkName = $this->getModelSchemas()->getPrimaryKey($parentClass); |
1766 | 1766 | |
1767 | - $registerModelAtPath = function ($model, string $path) use ($deDup, $modelsAtPath, $idsAtPath) { |
|
1767 | + $registerModelAtPath = function($model, string $path) use ($deDup, $modelsAtPath, $idsAtPath) { |
|
1768 | 1768 | return self::registerModelAtPath( |
1769 | 1769 | $model, |
1770 | 1770 | $path, |
@@ -1776,7 +1776,7 @@ discard block |
||
1776 | 1776 | }; |
1777 | 1777 | |
1778 | 1778 | foreach ($childRelationships as $name) { |
1779 | - $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath . static::PATH_SEPARATOR . $name : $name; |
|
1779 | + $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath.static::PATH_SEPARATOR.$name : $name; |
|
1780 | 1780 | |
1781 | 1781 | $relationshipType = $this->getModelSchemas()->getRelationshipType($parentClass, $name); |
1782 | 1782 | list ($targetModelClass, $reverseRelName) = |
@@ -1831,7 +1831,7 @@ discard block |
||
1831 | 1831 | [$pkName => [FilterParameterInterface::OPERATION_EQUALS => [$parent->{$pkName}]]], |
1832 | 1832 | [] |
1833 | 1833 | ); |
1834 | - $children = $this->fetchPaginatedResourcesWithoutRelationships( |
|
1834 | + $children = $this->fetchPaginatedResourcesWithoutRelationships( |
|
1835 | 1835 | $clonedBuilder, |
1836 | 1836 | $clonedBuilder->getModelClass() |
1837 | 1837 | ); |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare (strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace Limoncello\Flute\Api; |
4 | 4 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare (strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace Limoncello\Flute\Package; |
4 | 4 | |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | ); |
105 | 105 | assert(empty($jsonQueryValFileMask) === false, "Invalid Query Validators file mask `$jsonQueryValFileMask`."); |
106 | 106 | |
107 | - $schemasPath = $schemasFolder . DIRECTORY_SEPARATOR . $schemasFileMask; |
|
108 | - $jsonDataValPath = $jsonDataValFolder . DIRECTORY_SEPARATOR . $jsonDataValFileMask; |
|
109 | - $formsValidatorsPath = $formsValFolder . DIRECTORY_SEPARATOR . $formsValFileMask; |
|
110 | - $jsonQueryValPath = $jsonQueryValFolder . DIRECTORY_SEPARATOR . $jsonQueryValFileMask; |
|
107 | + $schemasPath = $schemasFolder.DIRECTORY_SEPARATOR.$schemasFileMask; |
|
108 | + $jsonDataValPath = $jsonDataValFolder.DIRECTORY_SEPARATOR.$jsonDataValFileMask; |
|
109 | + $formsValidatorsPath = $formsValFolder.DIRECTORY_SEPARATOR.$formsValFileMask; |
|
110 | + $jsonQueryValPath = $jsonQueryValFolder.DIRECTORY_SEPARATOR.$jsonQueryValFileMask; |
|
111 | 111 | |
112 | 112 | $requireUniqueTypes = $defaults[static::KEY_SCHEMAS_REQUIRE_UNIQUE_TYPES] ?? true; |
113 | 113 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare (strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace Limoncello\Flute\Package; |
4 | 4 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | $container[FactoryInterface::class] = $factory; |
57 | 57 | |
58 | - $container[JsonSchemasInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
58 | + $container[JsonSchemasInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
59 | 59 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
60 | 60 | $modelSchemas = $container->get(ModelSchemaInfoInterface::class); |
61 | 61 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | ); |
67 | 67 | }; |
68 | 68 | |
69 | - $container[ParametersMapperInterface::class] = function (PsrContainerInterface $container) { |
|
69 | + $container[ParametersMapperInterface::class] = function(PsrContainerInterface $container) { |
|
70 | 70 | return new ParametersMapper($container->get(JsonSchemasInterface::class)); |
71 | 71 | }; |
72 | 72 | |
73 | - $container[EncoderInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
73 | + $container[EncoderInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
74 | 74 | /** @var JsonSchemasInterface $jsonSchemas */ |
75 | 75 | $jsonSchemas = $container->get(JsonSchemasInterface::class); |
76 | 76 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
@@ -86,19 +86,19 @@ discard block |
||
86 | 86 | return $encoder; |
87 | 87 | }; |
88 | 88 | |
89 | - $container[RelationshipPaginationStrategyInterface::class] = function (PsrContainerInterface $container) { |
|
89 | + $container[RelationshipPaginationStrategyInterface::class] = function(PsrContainerInterface $container) { |
|
90 | 90 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
91 | 91 | |
92 | 92 | return new BasicRelationshipPaginationStrategy($settings[FluteSettings::KEY_DEFAULT_PAGING_SIZE]); |
93 | 93 | }; |
94 | 94 | |
95 | - $container[JsonApiParserFactoryInterface::class] = function (PsrContainerInterface $container) { |
|
95 | + $container[JsonApiParserFactoryInterface::class] = function(PsrContainerInterface $container) { |
|
96 | 96 | $factory = new JsonApiParserFactory($container); |
97 | 97 | |
98 | 98 | return $factory; |
99 | 99 | }; |
100 | 100 | |
101 | - $container[FormValidatorFactoryInterface::class] = function (PsrContainerInterface $container) { |
|
101 | + $container[FormValidatorFactoryInterface::class] = function(PsrContainerInterface $container) { |
|
102 | 102 | $factory = new FormValidatorFactory($container); |
103 | 103 | |
104 | 104 | 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 | /** @var CacheSettingsProviderInterface $provider */ |
121 | 121 | $provider = $container->get(CacheSettingsProviderInterface::class); |
122 | 122 | $appConfig = $provider->getApplicationConfiguration(); |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare (strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace Limoncello\Flute\Package; |
4 | 4 |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare (strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace Limoncello\Flute\Exceptions; |
4 | 4 |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare (strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace Limoncello\Flute; |
4 | 4 |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare (strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace Limoncello\Flute\Types; |
4 | 4 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare (strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | |
3 | 3 | namespace Limoncello\Flute\Encoder; |
4 | 4 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | parse_str($this->getOriginalUri()->getQuery(), $queryParams); |
128 | 128 | |
129 | - return function ($offset) use ($pageSize, $queryParams) { |
|
129 | + return function($offset) use ($pageSize, $queryParams) { |
|
130 | 130 | $paramsWithPaging = array_merge($queryParams, [ |
131 | 131 | BaseQueryParserInterface::PARAM_PAGE => [ |
132 | 132 | JsonApiQueryParserInterface::PARAM_PAGING_OFFSET => $offset, |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | ], |
135 | 135 | ]); |
136 | 136 | $newUri = $this->getOriginalUri()->withQuery(http_build_query($paramsWithPaging)); |
137 | - $fullUrl = (string)$newUri; |
|
137 | + $fullUrl = (string) $newUri; |
|
138 | 138 | $link = $this->getFactory()->createLink(false, $fullUrl, false); |
139 | 139 | |
140 | 140 | return $link; |