@@ -195,12 +195,12 @@ |
||
| 195 | 195 | return [static::DATA => $data->getData()]; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - $buildUrl = function ($offset) use ($data, $uri) { |
|
| 198 | + $buildUrl = function($offset) use ($data, $uri) { |
|
| 199 | 199 | $paramsWithPaging = [ |
| 200 | 200 | PaginationStrategyInterface::PARAM_PAGING_SKIP => $offset, |
| 201 | 201 | PaginationStrategyInterface::PARAM_PAGING_SIZE => $data->getLimit(), |
| 202 | 202 | ]; |
| 203 | - $fullUrl = $uri . '?' . http_build_query($paramsWithPaging); |
|
| 203 | + $fullUrl = $uri.'?'.http_build_query($paramsWithPaging); |
|
| 204 | 204 | |
| 205 | 205 | return $fullUrl; |
| 206 | 206 | }; |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | { |
| 160 | 160 | parse_str($this->getOriginalUri()->getQuery(), $queryParams); |
| 161 | 161 | |
| 162 | - return function ($offset) use ($pageSize, $queryParams) { |
|
| 162 | + return function($offset) use ($pageSize, $queryParams) { |
|
| 163 | 163 | $paramsWithPaging = array_merge($queryParams, [ |
| 164 | 164 | QueryParametersParserInterface::PARAM_PAGE => [ |
| 165 | 165 | PaginationStrategyInterface::PARAM_PAGING_SKIP => $offset, |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | ] |
| 168 | 168 | ]); |
| 169 | 169 | $newUri = $this->getOriginalUri()->withQuery(http_build_query($paramsWithPaging)); |
| 170 | - $fullUrl = (string)$newUri; |
|
| 170 | + $fullUrl = (string) $newUri; |
|
| 171 | 171 | $link = $this->getFactory()->createLink($fullUrl, null, true); |
| 172 | 172 | |
| 173 | 173 | return $link; |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | $settings = $container->get(SettingsProviderInterface::class)->get(S::class); |
| 101 | 101 | if ($settings[S::KEY_IS_DEBUG] === true) { |
| 102 | 102 | $message = $error->getMessage(); |
| 103 | - $details = (string)$error; |
|
| 103 | + $details = (string) $error; |
|
| 104 | 104 | } |
| 105 | 105 | $errors = new ErrorCollection(); |
| 106 | 106 | $errors->add(new Error(null, null, $httpCode, null, $message, $details)); |
@@ -48,20 +48,20 @@ discard block |
||
| 48 | 48 | assert(array_key_exists(SchemaInterface::class, class_implements($schemeClass)) === true); |
| 49 | 49 | $subUri = $type = $schemeClass::TYPE; |
| 50 | 50 | |
| 51 | - $indexSlug = '/{' . BaseController::ROUTE_KEY_INDEX . '}'; |
|
| 52 | - $params = function ($method) use ($type) { |
|
| 53 | - return [RouteInterface::PARAM_NAME => $type . '_' . $method]; |
|
| 51 | + $indexSlug = '/{'.BaseController::ROUTE_KEY_INDEX.'}'; |
|
| 52 | + $params = function($method) use ($type) { |
|
| 53 | + return [RouteInterface::PARAM_NAME => $type.'_'.$method]; |
|
| 54 | 54 | }; |
| 55 | - $handler = function ($method) use ($controllerClass) { |
|
| 55 | + $handler = function($method) use ($controllerClass) { |
|
| 56 | 56 | return [$controllerClass, $method]; |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | 59 | return $group |
| 60 | 60 | ->get($subUri, $handler(CI::METHOD_INDEX), $params(CI::METHOD_INDEX)) |
| 61 | 61 | ->post($subUri, $handler(CI::METHOD_CREATE), $params(CI::METHOD_CREATE)) |
| 62 | - ->get($subUri . $indexSlug, $handler(CI::METHOD_READ), $params(CI::METHOD_READ)) |
|
| 63 | - ->patch($subUri . $indexSlug, $handler(CI::METHOD_UPDATE), $params(CI::METHOD_UPDATE)) |
|
| 64 | - ->delete($subUri . $indexSlug, $handler(CI::METHOD_DELETE), $params(CI::METHOD_DELETE)); |
|
| 62 | + ->get($subUri.$indexSlug, $handler(CI::METHOD_READ), $params(CI::METHOD_READ)) |
|
| 63 | + ->patch($subUri.$indexSlug, $handler(CI::METHOD_UPDATE), $params(CI::METHOD_UPDATE)) |
|
| 64 | + ->delete($subUri.$indexSlug, $handler(CI::METHOD_DELETE), $params(CI::METHOD_DELETE)); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -84,18 +84,18 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | /** @var SchemaInterface $schemaClass */ |
| 86 | 86 | assert(array_key_exists(SchemaInterface::class, class_implements($schemaClass)) === true); |
| 87 | - $subUri = $schemaClass::TYPE; |
|
| 87 | + $subUri = $schemaClass::TYPE; |
|
| 88 | 88 | |
| 89 | 89 | /** @var string $controllerClass */ |
| 90 | 90 | /** @var string $schemaClass */ |
| 91 | 91 | |
| 92 | - $resourceIdUri = $subUri . '/{' . BaseController::ROUTE_KEY_INDEX . '}/'; |
|
| 93 | - $selfUri = $resourceIdUri . DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $relationshipName; |
|
| 92 | + $resourceIdUri = $subUri.'/{'.BaseController::ROUTE_KEY_INDEX.'}/'; |
|
| 93 | + $selfUri = $resourceIdUri.DocumentInterface::KEYWORD_RELATIONSHIPS.'/'.$relationshipName; |
|
| 94 | 94 | |
| 95 | 95 | return $group |
| 96 | 96 | // `self` |
| 97 | 97 | ->get($selfUri, [$controllerClass, $selfGetMethod]) |
| 98 | 98 | // `related` |
| 99 | - ->get($resourceIdUri . $relationshipName, [$controllerClass, $selfGetMethod]); |
|
| 99 | + ->get($resourceIdUri.$relationshipName, [$controllerClass, $selfGetMethod]); |
|
| 100 | 100 | } |
| 101 | 101 | } |
@@ -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 |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * |
| 35 | 35 | * @return self |
| 36 | 36 | */ |
| 37 | - public function setRelationshipStorage(?RelationshipStorageInterface $storage): self; |
|
| 37 | + public function setRelationshipStorage(?RelationshipStorageInterface $storage) : self; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * @param string $schemaClass |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | /** |
| 62 | 62 | * @inheritdoc |
| 63 | 63 | */ |
| 64 | - public function setRelationshipStorage(?RelationshipStorageInterface $storage): JsonSchemesInterface |
|
| 64 | + public function setRelationshipStorage(?RelationshipStorageInterface $storage) : JsonSchemesInterface |
|
| 65 | 65 | { |
| 66 | 66 | $this->relationshipStorage = $storage; |
| 67 | 67 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | /** |
| 307 | 307 | * @inheritdoc |
| 308 | 308 | */ |
| 309 | - public function readRow($index): ?array |
|
| 309 | + public function readRow($index): ? array |
|
| 310 | 310 | { |
| 311 | 311 | if ($index !== null && is_scalar($index) === false) { |
| 312 | 312 | throw new InvalidArgumentException( |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | $deleted = $builder->execute(); |
| 344 | 344 | |
| 345 | - return (int)$deleted; |
|
| 345 | + return (int) $deleted; |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /** |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $saveMain = $this->getRepository()->create($modelClass, $allowedChanges); |
| 364 | 364 | $saveMain = $this->builderSaveResourceOnCreate($saveMain); |
| 365 | 365 | $saveMain->getSQL(); // prepare |
| 366 | - $this->inTransaction(function () use ($modelClass, $saveMain, $toMany, &$index) { |
|
| 366 | + $this->inTransaction(function() use ($modelClass, $saveMain, $toMany, &$index) { |
|
| 367 | 367 | $saveMain->execute(); |
| 368 | 368 | // if no index given will use last insert ID as index |
| 369 | 369 | $index !== null ?: $index = $saveMain->getConnection()->lastInsertId(); |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $saveMain = $this->getRepository()->update($modelClass, $index, $allowedChanges); |
| 403 | 403 | $saveMain = $this->builderSaveResourceOnUpdate($saveMain); |
| 404 | 404 | $saveMain->getSQL(); // prepare |
| 405 | - $this->inTransaction(function () use ($modelClass, $saveMain, $toMany, $index, &$updated) { |
|
| 405 | + $this->inTransaction(function() use ($modelClass, $saveMain, $toMany, $index, &$updated) { |
|
| 406 | 406 | $updated = $saveMain->execute(); |
| 407 | 407 | foreach ($toMany as $name => $values) { |
| 408 | 408 | $indexBind = ':index'; |
@@ -417,12 +417,12 @@ discard block |
||
| 417 | 417 | $saveToMany = $this->builderSaveRelationshipOnUpdate($name, $saveToMany); |
| 418 | 418 | $saveToMany->setParameter($indexBind, $index); |
| 419 | 419 | foreach ($values as $value) { |
| 420 | - $updated += (int)$saveToMany->setParameter($otherIndexBind, $value)->execute(); |
|
| 420 | + $updated += (int) $saveToMany->setParameter($otherIndexBind, $value)->execute(); |
|
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | }); |
| 424 | 424 | |
| 425 | - return (int)$updated; |
|
| 425 | + return (int) $updated; |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | /** |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | * |
| 528 | 528 | * @return array|null |
| 529 | 529 | */ |
| 530 | - protected function fetchRow(QueryBuilder $builder, string $class): ?array |
|
| 530 | + protected function fetchRow(QueryBuilder $builder, string $class): ? array |
|
| 531 | 531 | { |
| 532 | 532 | $statement = $builder->execute(); |
| 533 | 533 | $statement->setFetchMode(PDOConnection::FETCH_ASSOC); |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | foreach ($path->getPath() as $pathPiece) { |
| 840 | 840 | $parent = $tmpPath; |
| 841 | 841 | $tmpPath = empty($tmpPath) === true ? |
| 842 | - $pathPiece : $tmpPath . static::PATH_SEPARATOR . $pathPiece; |
|
| 842 | + $pathPiece : $tmpPath.static::PATH_SEPARATOR.$pathPiece; |
|
| 843 | 843 | $normalizedPaths[$tmpPath] = [$parent, $pathPiece]; |
| 844 | 844 | $pathsDepths[$parent] = $parentDepth++; |
| 845 | 845 | } |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | // $models. |
| 891 | 891 | |
| 892 | 892 | foreach ($childRelationships as $name) { |
| 893 | - $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath . static::PATH_SEPARATOR . $name : $name; |
|
| 893 | + $childrenPath = $parentsPath !== static::ROOT_PATH ? $parentsPath.static::PATH_SEPARATOR.$name : $name; |
|
| 894 | 894 | |
| 895 | 895 | /** @var QueryBuilder $builder */ |
| 896 | 896 | list ($builder, $class, $relationshipType) = |