@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | assert(class_exists($controllerClass) === true); |
49 | 49 | |
50 | 50 | $groupPrefix = $group->getUriPrefix(); |
51 | - $indexSlug = '/{' . JCI::ROUTE_KEY_INDEX . '}'; |
|
52 | - $params = function (string $method) use ($groupPrefix, $resourceName): array { |
|
51 | + $indexSlug = '/{'.JCI::ROUTE_KEY_INDEX.'}'; |
|
52 | + $params = function(string $method) use ($groupPrefix, $resourceName): array { |
|
53 | 53 | return [RouteInterface::PARAM_NAME => static::routeName($groupPrefix, $resourceName, $method)]; |
54 | 54 | }; |
55 | - $handler = function (string $method) use ($controllerClass): array { |
|
55 | + $handler = function(string $method) use ($controllerClass): array { |
|
56 | 56 | return [$controllerClass, $method]; |
57 | 57 | }; |
58 | 58 | |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | $group->post($resourceName, $handler(JCI::METHOD_CREATE), $params(JCI::METHOD_CREATE)); |
66 | 66 | } |
67 | 67 | if (in_array(ControllerReadInterface::class, $classInterfaces) === true) { |
68 | - $group->get($resourceName . $indexSlug, $handler(JCI::METHOD_READ), $params(JCI::METHOD_READ)); |
|
68 | + $group->get($resourceName.$indexSlug, $handler(JCI::METHOD_READ), $params(JCI::METHOD_READ)); |
|
69 | 69 | } |
70 | 70 | if (in_array(ControllerUpdateInterface::class, $classInterfaces) === true) { |
71 | - $group->patch($resourceName . $indexSlug, $handler(JCI::METHOD_UPDATE), $params(JCI::METHOD_UPDATE)); |
|
71 | + $group->patch($resourceName.$indexSlug, $handler(JCI::METHOD_UPDATE), $params(JCI::METHOD_UPDATE)); |
|
72 | 72 | } |
73 | 73 | if (in_array(ControllerDeleteInterface::class, $classInterfaces) === true) { |
74 | - $group->delete($resourceName . $indexSlug, $handler(JCI::METHOD_DELETE), $params(JCI::METHOD_DELETE)); |
|
74 | + $group->delete($resourceName.$indexSlug, $handler(JCI::METHOD_DELETE), $params(JCI::METHOD_DELETE)); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | return $group; |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | $groupPrefix = $group->getUriPrefix(); |
100 | - $slugged = $subUri . '/{' . FCI::ROUTE_KEY_INDEX . '}'; |
|
101 | - $params = function (string $method) use ($groupPrefix, $subUri) : array { |
|
100 | + $slugged = $subUri.'/{'.FCI::ROUTE_KEY_INDEX.'}'; |
|
101 | + $params = function(string $method) use ($groupPrefix, $subUri) : array { |
|
102 | 102 | return [RouteInterface::PARAM_NAME => static::routeName($groupPrefix, $subUri, $method)]; |
103 | 103 | }; |
104 | - $handler = function (string $method) use ($controllerClass): array { |
|
104 | + $handler = function(string $method) use ($controllerClass): array { |
|
105 | 105 | return [$controllerClass, $method]; |
106 | 106 | }; |
107 | 107 | |
@@ -112,10 +112,10 @@ discard block |
||
112 | 112 | $group->get($subUri, $handler(FCI::METHOD_INDEX), $params(FCI::METHOD_INDEX)); |
113 | 113 | } |
114 | 114 | if (in_array(ControllerInstanceInterface::class, $classInterfaces) === true) { |
115 | - $group->get($subUri . $createSubUrl, $handler(FCI::METHOD_INSTANCE), $params(FCI::METHOD_INSTANCE)); |
|
115 | + $group->get($subUri.$createSubUrl, $handler(FCI::METHOD_INSTANCE), $params(FCI::METHOD_INSTANCE)); |
|
116 | 116 | } |
117 | 117 | if (in_array(ControllerCreateInterface::class, $classInterfaces) === true) { |
118 | - $group->post($subUri . $createSubUrl, $handler(FCI::METHOD_CREATE), $params(FCI::METHOD_CREATE)); |
|
118 | + $group->post($subUri.$createSubUrl, $handler(FCI::METHOD_CREATE), $params(FCI::METHOD_CREATE)); |
|
119 | 119 | } |
120 | 120 | if (in_array(ControllerReadInterface::class, $classInterfaces) === true) { |
121 | 121 | $group->get($slugged, $handler(FCI::METHOD_READ), $params(FCI::METHOD_READ)); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $group->post($slugged, $handler(FCI::METHOD_UPDATE), $params(FCI::METHOD_UPDATE)); |
125 | 125 | } |
126 | 126 | if (in_array(ControllerDeleteInterface::class, $classInterfaces) === true) { |
127 | - $deleteUri = $slugged . '/' . FCI::METHOD_DELETE; |
|
127 | + $deleteUri = $slugged.'/'.FCI::METHOD_DELETE; |
|
128 | 128 | $group->post($deleteUri, $handler(FCI::METHOD_DELETE), $params(FCI::METHOD_DELETE)); |
129 | 129 | } |
130 | 130 | |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | string $controllerClass, |
148 | 148 | string $selfGetMethod |
149 | 149 | ): GroupInterface { |
150 | - $resourceIdUri = $resourceName . '/{' . JCI::ROUTE_KEY_INDEX . '}/'; |
|
151 | - $selfUri = $resourceIdUri . DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $relationshipName; |
|
150 | + $resourceIdUri = $resourceName.'/{'.JCI::ROUTE_KEY_INDEX.'}/'; |
|
151 | + $selfUri = $resourceIdUri.DocumentInterface::KEYWORD_RELATIONSHIPS.'/'.$relationshipName; |
|
152 | 152 | |
153 | 153 | return $group |
154 | 154 | // `self` |
155 | 155 | ->get($selfUri, [$controllerClass, $selfGetMethod]) |
156 | 156 | // `related` |
157 | - ->get($resourceIdUri . $relationshipName, [$controllerClass, $selfGetMethod]); |
|
157 | + ->get($resourceIdUri.$relationshipName, [$controllerClass, $selfGetMethod]); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | string $controllerClass, |
174 | 174 | string $addMethod |
175 | 175 | ): GroupInterface { |
176 | - $url = $resourceName . '/{' . JCI::ROUTE_KEY_INDEX . '}/' . |
|
177 | - DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $relationshipName; |
|
176 | + $url = $resourceName.'/{'.JCI::ROUTE_KEY_INDEX.'}/'. |
|
177 | + DocumentInterface::KEYWORD_RELATIONSHIPS.'/'.$relationshipName; |
|
178 | 178 | |
179 | 179 | return $group->post($url, [$controllerClass, $addMethod]); |
180 | 180 | } |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | string $controllerClass, |
196 | 196 | string $deleteMethod |
197 | 197 | ): GroupInterface { |
198 | - $url = $resourceName . '/{' . JCI::ROUTE_KEY_INDEX . '}/' . |
|
199 | - DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $relationshipName; |
|
198 | + $url = $resourceName.'/{'.JCI::ROUTE_KEY_INDEX.'}/'. |
|
199 | + DocumentInterface::KEYWORD_RELATIONSHIPS.'/'.$relationshipName; |
|
200 | 200 | |
201 | 201 | return $group->delete($url, [$controllerClass, $deleteMethod]); |
202 | 202 | } |
@@ -222,6 +222,6 @@ discard block |
||
222 | 222 | $subUri = substr($subUri, 0, -1); |
223 | 223 | } |
224 | 224 | |
225 | - return $prefix . $subUri . '::' . $method; |
|
225 | + return $prefix.$subUri.'::'.$method; |
|
226 | 226 | } |
227 | 227 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | throw new InvalidArgumentException($this->getMessage(Messages::MSG_ERR_INVALID_ARGUMENT)); |
213 | 213 | } |
214 | 214 | |
215 | - assert(call_user_func(function () use ($indexes) { |
|
215 | + assert(call_user_func(function() use ($indexes) { |
|
216 | 216 | $allOk = true; |
217 | 217 | |
218 | 218 | foreach ($indexes as $index) { |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | $classAtPath = new ArrayObject(); |
765 | 765 | $idsAtPath = new ArrayObject(); |
766 | 766 | |
767 | - $registerModelAtRoot = function ($model) use ($modelStorage, $modelsAtPath, $idsAtPath): void { |
|
767 | + $registerModelAtRoot = function($model) use ($modelStorage, $modelsAtPath, $idsAtPath): void { |
|
768 | 768 | self::registerModelAtPath( |
769 | 769 | $model, |
770 | 770 | static::ROOT_PATH, |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | assert(is_string($pathPiece)); |
853 | 853 | $parent = $tmpPath; |
854 | 854 | $tmpPath = empty($tmpPath) === true ? |
855 | - $pathPiece : $tmpPath . static::PATH_SEPARATOR . $pathPiece; |
|
855 | + $pathPiece : $tmpPath.static::PATH_SEPARATOR.$pathPiece; |
|
856 | 856 | $normalizedPaths[$tmpPath] = [$parent, $pathPiece]; |
857 | 857 | $pathsDepths[$parent] = $parentDepth++; |
858 | 858 | } |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | ): ModelQueryBuilder { |
1022 | 1022 | assert( |
1023 | 1023 | $this->getModelSchemas()->hasRelationship($this->getModelClass(), $relationshipName), |
1024 | - "Relationship `$relationshipName` do not exist in model `" . $this->getModelClass() . '`' |
|
1024 | + "Relationship `$relationshipName` do not exist in model `".$this->getModelClass().'`' |
|
1025 | 1025 | ); |
1026 | 1026 | |
1027 | 1027 | // as we read data from a relationship our main table and model would be the table/model in the relationship |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | if ($this->hasFilters() === true) { |
1040 | 1040 | $filters = $this->getFilters(); |
1041 | 1041 | $sorts = $this->getSorts(); |
1042 | - $joinCondition = $this->areFiltersWithAnd() === true ? ModelQueryBuilder::AND : ModelQueryBuilder::OR; |
|
1042 | + $joinCondition = $this->areFiltersWithAnd() === true ? ModelQueryBuilder:: AND : ModelQueryBuilder:: OR ; |
|
1043 | 1043 | $builder->addRelationshipFiltersAndSorts($reverseRelName, $filters, $sorts, $joinCondition); |
1044 | 1044 | } |
1045 | 1045 | // ... and the input filters to actual data we select |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | ) { |
1071 | 1071 | assert( |
1072 | 1072 | $this->getModelSchemas()->hasRelationship($this->getModelClass(), $name), |
1073 | - "Relationship `$name` do not exist in model `" . $this->getModelClass() . '`' |
|
1073 | + "Relationship `$name` do not exist in model `".$this->getModelClass().'`' |
|
1074 | 1074 | ); |
1075 | 1075 | |
1076 | 1076 | // depending on the relationship type we expect the result to be either single resource or a collection |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | ): array { |
1100 | 1100 | assert( |
1101 | 1101 | $this->getModelSchemas()->hasRelationship($this->getModelClass(), $name), |
1102 | - "Relationship `$name` do not exist in model `" . $this->getModelClass() . '`' |
|
1102 | + "Relationship `$name` do not exist in model `".$this->getModelClass().'`' |
|
1103 | 1103 | ); |
1104 | 1104 | |
1105 | 1105 | // depending on the relationship type we expect the result to be either single resource or a collection |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | |
1176 | 1176 | $this->clearFetchParameters(); |
1177 | 1177 | |
1178 | - return (int)$deleted; |
|
1178 | + return (int) $deleted; |
|
1179 | 1179 | } |
1180 | 1180 | |
1181 | 1181 | /** |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | |
1192 | 1192 | $this->clearFetchParameters(); |
1193 | 1193 | |
1194 | - return (int)$deleted > 0; |
|
1194 | + return (int) $deleted > 0; |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | /** |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | |
1217 | 1217 | $this->clearBuilderParameters()->clearFetchParameters(); |
1218 | 1218 | |
1219 | - $this->inTransaction(function () use ($saveMain, $toMany, &$index) { |
|
1219 | + $this->inTransaction(function() use ($saveMain, $toMany, &$index) { |
|
1220 | 1220 | $saveMain->execute(); |
1221 | 1221 | |
1222 | 1222 | // if no index given will use last insert ID as index |
@@ -1257,12 +1257,12 @@ discard block |
||
1257 | 1257 | ->createBuilder($this->getModelClass()) |
1258 | 1258 | ->updateModels($allowedChanges) |
1259 | 1259 | ->addFiltersWithAndToTable($filters); |
1260 | - $saveMain = $this->builderSaveResourceOnUpdate($saveMain); |
|
1260 | + $saveMain = $this->builderSaveResourceOnUpdate($saveMain); |
|
1261 | 1261 | $saveMain->getSQL(); // prepare |
1262 | 1262 | |
1263 | 1263 | $this->clearBuilderParameters()->clearFetchParameters(); |
1264 | 1264 | |
1265 | - $this->inTransaction(function () use ($saveMain, $toMany, $index, &$updated) { |
|
1265 | + $this->inTransaction(function() use ($saveMain, $toMany, $index, &$updated) { |
|
1266 | 1266 | $updated = $saveMain->execute(); |
1267 | 1267 | |
1268 | 1268 | $builderHook = Closure::fromCallable([$this, 'builderSaveRelationshipOnUpdate']); |
@@ -1278,7 +1278,7 @@ discard block |
||
1278 | 1278 | )->execute(); |
1279 | 1279 | |
1280 | 1280 | // add new ones |
1281 | - $updated += $this->addInToManyRelationship( |
|
1281 | + $updated += $this->addInToManyRelationship( |
|
1282 | 1282 | $connection, |
1283 | 1283 | $index, |
1284 | 1284 | $relationshipName, |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | } |
1289 | 1289 | }); |
1290 | 1290 | |
1291 | - return (int)$updated; |
|
1291 | + return (int) $updated; |
|
1292 | 1292 | } |
1293 | 1293 | |
1294 | 1294 | /** |
@@ -1303,9 +1303,9 @@ discard block |
||
1303 | 1303 | public function createInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int |
1304 | 1304 | { |
1305 | 1305 | // Check that relationship is `BelongsToMany` |
1306 | - assert(call_user_func(function () use ($name): bool { |
|
1306 | + assert(call_user_func(function() use ($name): bool { |
|
1307 | 1307 | $relType = $this->getModelSchemas()->getRelationshipType($this->getModelClass(), $name); |
1308 | - $errMsg = "Relationship `$name` of class `" . $this->getModelClass() . |
|
1308 | + $errMsg = "Relationship `$name` of class `".$this->getModelClass(). |
|
1309 | 1309 | '` either is not `belongsToMany` or do not exist in the class.'; |
1310 | 1310 | $isOk = $relType === RelationshipTypes::BELONGS_TO_MANY; |
1311 | 1311 | |
@@ -1327,9 +1327,9 @@ discard block |
||
1327 | 1327 | public function removeInBelongsToManyRelationship(string $parentId, string $name, iterable $childIds): int |
1328 | 1328 | { |
1329 | 1329 | // Check that relationship is `BelongsToMany` |
1330 | - assert(call_user_func(function () use ($name): bool { |
|
1330 | + assert(call_user_func(function() use ($name): bool { |
|
1331 | 1331 | $relType = $this->getModelSchemas()->getRelationshipType($this->getModelClass(), $name); |
1332 | - $errMsg = "Relationship `$name` of class `" . $this->getModelClass() . |
|
1332 | + $errMsg = "Relationship `$name` of class `".$this->getModelClass(). |
|
1333 | 1333 | '` either is not `belongsToMany` or do not exist in the class.'; |
1334 | 1334 | $isOk = $relType === RelationshipTypes::BELONGS_TO_MANY; |
1335 | 1335 | |
@@ -1497,7 +1497,7 @@ discard block |
||
1497 | 1497 | { |
1498 | 1498 | $countBuilder = $this->createBuilder($this->getModelClass()); |
1499 | 1499 | $countBuilder->setParameters($builder->getParameters()); |
1500 | - $countBuilder->select('COUNT(*)')->from('(' . $builder->getSQL() . ') AS RESULT'); |
|
1500 | + $countBuilder->select('COUNT(*)')->from('('.$builder->getSQL().') AS RESULT'); |
|
1501 | 1501 | |
1502 | 1502 | return $countBuilder; |
1503 | 1503 | } |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | |
1530 | 1530 | foreach ($secondaryIdentities as $secondaryId) { |
1531 | 1531 | try { |
1532 | - $inserted += (int)$saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute(); |
|
1532 | + $inserted += (int) $saveToMany->setParameter($secondaryIdBindName, $secondaryId)->execute(); |
|
1533 | 1533 | } /** @noinspection PhpRedundantCatchClauseInspection */ catch (UcvException $exception) { |
1534 | 1534 | // Spec: If all of the specified resources can be added to, or are already present in, |
1535 | 1535 | // the relationship then the server MUST return a successful response. |
@@ -1776,7 +1776,7 @@ discard block |
||
1776 | 1776 | |
1777 | 1777 | $pkName = $this->getModelSchemas()->getPrimaryKey($parentClass); |
1778 | 1778 | |
1779 | - $registerModelAtPath = function ($model, string $path) use ($deDup, $modelsAtPath, $idsAtPath) { |
|
1779 | + $registerModelAtPath = function($model, string $path) use ($deDup, $modelsAtPath, $idsAtPath) { |
|
1780 | 1780 | return self::registerModelAtPath( |
1781 | 1781 | $model, |
1782 | 1782 | $path, |
@@ -1788,7 +1788,7 @@ discard block |
||
1788 | 1788 | }; |
1789 | 1789 | |
1790 | 1790 | foreach ($childRelationships as $name) { |
1791 | - $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath . static::PATH_SEPARATOR . $name : $name; |
|
1791 | + $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath.static::PATH_SEPARATOR.$name : $name; |
|
1792 | 1792 | |
1793 | 1793 | $relationshipType = $this->getModelSchemas()->getRelationshipType($parentClass, $name); |
1794 | 1794 | list ($targetModelClass, $reverseRelName) = |
@@ -1843,7 +1843,7 @@ discard block |
||
1843 | 1843 | [$pkName => [FilterParameterInterface::OPERATION_EQUALS => [$parent->{$pkName}]]], |
1844 | 1844 | [] |
1845 | 1845 | ); |
1846 | - $children = $this->fetchPaginatedResourcesWithoutRelationships( |
|
1846 | + $children = $this->fetchPaginatedResourcesWithoutRelationships( |
|
1847 | 1847 | $clonedBuilder, |
1848 | 1848 | $clonedBuilder->getModelClass() |
1849 | 1849 | ); |
@@ -82,7 +82,6 @@ |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | return $result === true ? |
85 | - static::createSuccessReply($values) : |
|
86 | - static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
85 | + static::createSuccessReply($values) : static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
87 | 86 | } |
88 | 87 | } |
@@ -83,13 +83,12 @@ |
||
83 | 83 | ->where($builder->expr()->in($primaryName, $placeholders)) |
84 | 84 | ->execute(); |
85 | 85 | |
86 | - $count = (int)$statement->fetchColumn(); |
|
86 | + $count = (int) $statement->fetchColumn(); |
|
87 | 87 | $result = $count === count($values); |
88 | 88 | } |
89 | 89 | |
90 | 90 | $reply = $result === true ? |
91 | - static::createSuccessReply($values) : |
|
92 | - static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
91 | + static::createSuccessReply($values) : static::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
93 | 92 | |
94 | 93 | return $reply; |
95 | 94 | } |
@@ -242,12 +242,11 @@ discard block |
||
242 | 242 | $this->executeStarts($this->getSerializer()::readRuleStartIndexes($ruleIndexes)); |
243 | 243 | $ruleIndex = $this->getSerializer()::readRuleIndex($ruleIndexes); |
244 | 244 | $isFoundInToOne === true ? |
245 | - $this->validateAsToOneRelationship($ruleIndex, $name, $jsonData) : |
|
246 | - $this->validateAsToManyRelationship($ruleIndex, $name, $jsonData); |
|
245 | + $this->validateAsToOneRelationship($ruleIndex, $name, $jsonData) : $this->validateAsToManyRelationship($ruleIndex, $name, $jsonData); |
|
247 | 246 | $this->executeEnds($this->getSerializer()::readRuleEndIndexes($ruleIndexes)); |
248 | 247 | |
249 | 248 | if (count($this->getErrorAggregator()) > 0) { |
250 | - $status = JsonApiResponse::HTTP_CONFLICT; |
|
249 | + $status = JsonApiResponse::HTTP_CONFLICT; |
|
251 | 250 | foreach ($this->getErrorAggregator()->get() as $error) { |
252 | 251 | $this->getJsonApiErrorCollection()->addValidationRelationshipError($error, $status); |
253 | 252 | $this->addErrorStatus($status); |
@@ -362,7 +361,7 @@ discard block |
||
362 | 361 | |
363 | 362 | if (count($this->getErrorAggregator()) > 0) { |
364 | 363 | $title = $this->formatMessage(ErrorCodes::INVALID_VALUE); |
365 | - $status = JsonApiResponse::HTTP_CONFLICT; |
|
364 | + $status = JsonApiResponse::HTTP_CONFLICT; |
|
366 | 365 | foreach ($this->getErrorAggregator()->get() as $error) { |
367 | 366 | $details = $this->getMessage($error); |
368 | 367 | $this->getJsonApiErrorCollection()->addDataTypeError($title, $details, $status); |
@@ -453,7 +452,7 @@ discard block |
||
453 | 452 | $this->executeEnds($this->getSerializer()::readRulesEndIndexes($this->getAttributeRules())); |
454 | 453 | |
455 | 454 | if (count($this->getErrorAggregator()) > 0) { |
456 | - $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
|
455 | + $status = JsonApiResponse::HTTP_UNPROCESSABLE_ENTITY; |
|
457 | 456 | foreach ($this->getErrorAggregator()->get() as $error) { |
458 | 457 | $this->getJsonApiErrorCollection()->addValidationAttributeError($error, $status); |
459 | 458 | } |
@@ -520,7 +519,7 @@ discard block |
||
520 | 519 | )); |
521 | 520 | |
522 | 521 | if (count($this->getErrorAggregator()) > 0) { |
523 | - $status = JsonApiResponse::HTTP_CONFLICT; |
|
522 | + $status = JsonApiResponse::HTTP_CONFLICT; |
|
524 | 523 | foreach ($this->getErrorAggregator()->get() as $error) { |
525 | 524 | $this->getJsonApiErrorCollection()->addValidationRelationshipError($error, $status); |
526 | 525 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $container[FactoryInterface::class] = $factory; |
55 | 55 | |
56 | - $container[JsonSchemasInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
56 | + $container[JsonSchemasInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
57 | 57 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
58 | 58 | $modelSchemas = $container->get(ModelSchemaInfoInterface::class); |
59 | 59 | |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | ); |
65 | 65 | }; |
66 | 66 | |
67 | - $container[ParametersMapperInterface::class] = function (PsrContainerInterface $container) { |
|
67 | + $container[ParametersMapperInterface::class] = function(PsrContainerInterface $container) { |
|
68 | 68 | return new ParametersMapper($container->get(JsonSchemasInterface::class)); |
69 | 69 | }; |
70 | 70 | |
71 | - $container[EncoderInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
71 | + $container[EncoderInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
72 | 72 | /** @var JsonSchemasInterface $jsonSchemas */ |
73 | 73 | $jsonSchemas = $container->get(JsonSchemasInterface::class); |
74 | 74 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
@@ -84,19 +84,19 @@ discard block |
||
84 | 84 | return $encoder; |
85 | 85 | }; |
86 | 86 | |
87 | - $container[RelationshipPaginationStrategyInterface::class] = function (PsrContainerInterface $container) { |
|
87 | + $container[RelationshipPaginationStrategyInterface::class] = function(PsrContainerInterface $container) { |
|
88 | 88 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
89 | 89 | |
90 | 90 | return new BasicRelationshipPaginationStrategy($settings[FluteSettings::KEY_DEFAULT_PAGING_SIZE]); |
91 | 91 | }; |
92 | 92 | |
93 | - $container[JsonApiParserFactoryInterface::class] = function (PsrContainerInterface $container) { |
|
93 | + $container[JsonApiParserFactoryInterface::class] = function(PsrContainerInterface $container) { |
|
94 | 94 | $factory = new JsonApiParserFactory($container); |
95 | 95 | |
96 | 96 | return $factory; |
97 | 97 | }; |
98 | 98 | |
99 | - $container[FormValidatorFactoryInterface::class] = function (PsrContainerInterface $container) { |
|
99 | + $container[FormValidatorFactoryInterface::class] = function(PsrContainerInterface $container) { |
|
100 | 100 | $factory = new FormValidatorFactory($container); |
101 | 101 | |
102 | 102 | return $factory; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public static function configureExceptionHandler(LimoncelloContainerInterface $container) |
116 | 116 | { |
117 | - $container[ThrowableHandlerInterface::class] = function (PsrContainerInterface $container) { |
|
117 | + $container[ThrowableHandlerInterface::class] = function(PsrContainerInterface $container) { |
|
118 | 118 | /** @var CacheSettingsProviderInterface $provider */ |
119 | 119 | $provider = $container->get(CacheSettingsProviderInterface::class); |
120 | 120 | $appConfig = $provider->getApplicationConfiguration(); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | parse_str($this->getOriginalUri()->getQuery(), $queryParams); |
126 | 126 | |
127 | - return function ($offset) use ($pageSize, $queryParams) { |
|
127 | + return function($offset) use ($pageSize, $queryParams) { |
|
128 | 128 | $paramsWithPaging = array_merge($queryParams, [ |
129 | 129 | BaseQueryParserInterface::PARAM_PAGE => [ |
130 | 130 | JsonApiQueryParserInterface::PARAM_PAGING_OFFSET => $offset, |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ], |
133 | 133 | ]); |
134 | 134 | $newUri = $this->getOriginalUri()->withQuery(http_build_query($paramsWithPaging)); |
135 | - $fullUrl = (string)$newUri; |
|
135 | + $fullUrl = (string) $newUri; |
|
136 | 136 | $link = $this->getFactory()->createLink(false, $fullUrl, false); |
137 | 137 | |
138 | 138 | return $link; |
@@ -130,7 +130,7 @@ |
||
130 | 130 | $details = null; |
131 | 131 | if ($this->isDebug === true) { |
132 | 132 | $message = $throwable->getMessage(); |
133 | - $details = (string)$throwable; |
|
133 | + $details = (string) $throwable; |
|
134 | 134 | } |
135 | 135 | $errors->add(new Error(null, null, null, $httpCode, null, $message, $details)); |
136 | 136 | } |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | $modelClass = $schemaClass::MODEL; |
647 | 647 | assert($schemaInfo->hasRelationship($modelClass, $modelRelName)); |
648 | 648 | assert( |
649 | - ($type =$schemaInfo->getRelationshipType($modelClass, $modelRelName)) === RelationshipTypes::BELONGS_TO || |
|
649 | + ($type = $schemaInfo->getRelationshipType($modelClass, $modelRelName)) === RelationshipTypes::BELONGS_TO || |
|
650 | 650 | $type === RelationshipTypes::BELONGS_TO_MANY |
651 | 651 | ); |
652 | 652 | |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | ): string { |
903 | 903 | $schema = $jsonSchemas->getSchema($model); |
904 | 904 | $selfLink = $schema->getSelfLink($model); |
905 | - $urlPrefix = (string)$requestUri->withPath('')->withQuery('')->withFragment(''); |
|
905 | + $urlPrefix = (string) $requestUri->withPath('')->withQuery('')->withFragment(''); |
|
906 | 906 | $fullUrl = $selfLink->getStringRepresentation($urlPrefix); |
907 | 907 | |
908 | 908 | return $fullUrl; |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | */ |
916 | 916 | private static function assertClassValueDefined(?string $value): void |
917 | 917 | { |
918 | - assert(empty($value) === false, 'Value should be defined in `' . static::class . '`.'); |
|
918 | + assert(empty($value) === false, 'Value should be defined in `'.static::class.'`.'); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | /** |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | { |
929 | 929 | assert( |
930 | 930 | array_key_exists($interface, class_implements($class)) === true, |
931 | - "Class `$class` should implement `" . $interface . '` interface.' |
|
931 | + "Class `$class` should implement `".$interface.'` interface.' |
|
932 | 932 | ); |
933 | 933 | } |
934 | 934 | } |