@@ -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 |
@@ -49,18 +49,18 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $container[FactoryInterface::class] = $factory; |
| 51 | 51 | |
| 52 | - $container[QueryParametersParserInterface::class] = function () use ($factory) { |
|
| 52 | + $container[QueryParametersParserInterface::class] = function() use ($factory) { |
|
| 53 | 53 | return $factory->getJsonApiFactory()->createQueryParametersParser(); |
| 54 | 54 | }; |
| 55 | 55 | |
| 56 | - $container[JsonSchemesInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
| 56 | + $container[JsonSchemesInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
| 57 | 57 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
| 58 | 58 | $modelSchemes = $container->get(ModelSchemeInfoInterface::class); |
| 59 | 59 | |
| 60 | 60 | return $factory->createJsonSchemes($settings[FluteSettings::KEY_MODEL_TO_SCHEME_MAP], $modelSchemes); |
| 61 | 61 | }; |
| 62 | 62 | |
| 63 | - $container[EncoderInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
| 63 | + $container[EncoderInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
| 64 | 64 | /** @var JsonSchemesInterface $jsonSchemes */ |
| 65 | 65 | $jsonSchemes = $container->get(JsonSchemesInterface::class); |
| 66 | 66 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | return $encoder; |
| 76 | 76 | }; |
| 77 | 77 | |
| 78 | - $container[FilterOperationsInterface::class] = function (PsrContainerInterface $container) { |
|
| 78 | + $container[FilterOperationsInterface::class] = function(PsrContainerInterface $container) { |
|
| 79 | 79 | return new FilterOperations($container); |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | - $container[RepositoryInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
| 82 | + $container[RepositoryInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
| 83 | 83 | $connection = $container->get(Connection::class); |
| 84 | 84 | /** @var ModelSchemeInfoInterface $modelSchemes */ |
| 85 | 85 | $modelSchemes = $container->get(ModelSchemeInfoInterface::class); |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | return $factory->createRepository($connection, $modelSchemes, $filerOps, $formatter); |
| 95 | 95 | }; |
| 96 | 96 | |
| 97 | - $container[PaginationStrategyInterface::class] = function (PsrContainerInterface $container) { |
|
| 97 | + $container[PaginationStrategyInterface::class] = function(PsrContainerInterface $container) { |
|
| 98 | 98 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
| 99 | 99 | |
| 100 | 100 | return new PaginationStrategy($settings[FluteSettings::KEY_RELATIONSHIP_PAGING_SIZE]); |
| 101 | 101 | }; |
| 102 | 102 | |
| 103 | - $container[JsonApiValidatorFactoryInterface::class] = function (PsrContainerInterface $container) { |
|
| 103 | + $container[JsonApiValidatorFactoryInterface::class] = function(PsrContainerInterface $container) { |
|
| 104 | 104 | $factory = new JsonApiValidatorFactory($container); |
| 105 | 105 | |
| 106 | 106 | return $factory; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public static function configureExceptionHandler(LimoncelloContainerInterface $container) |
| 127 | 127 | { |
| 128 | - $container[ExceptionHandlerInterface::class] = function () { |
|
| 128 | + $container[ExceptionHandlerInterface::class] = function() { |
|
| 129 | 129 | return new FluteExceptionHandler(); |
| 130 | 130 | }; |
| 131 | 131 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * @inheritdoc |
| 55 | 55 | */ |
| 56 | - public function getRelationshipStorage(): ?RelationshipStorageInterface |
|
| 56 | + public function getRelationshipStorage(): ? RelationshipStorageInterface |
|
| 57 | 57 | { |
| 58 | 58 | return $this->relationshipStorage; |
| 59 | 59 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 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 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | /** |
| 59 | 59 | * @inheritdoc |
| 60 | 60 | */ |
| 61 | - public function getRelationshipStorage(): ?RelationshipStorageInterface |
|
| 61 | + public function getRelationshipStorage(): ? RelationshipStorageInterface |
|
| 62 | 62 | { |
| 63 | 63 | return $this->relationshipStorage; |
| 64 | 64 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | /** |
| 164 | 164 | * @inheritdoc |
| 165 | 165 | */ |
| 166 | - public function count(FilterParameterCollection $filterParams = null): ?int |
|
| 166 | + public function count(FilterParameterCollection $filterParams = null): ? int |
|
| 167 | 167 | { |
| 168 | 168 | $modelClass = $this->getModelClass(); |
| 169 | 169 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | /** |
| 282 | 282 | * @inheritdoc |
| 283 | 283 | */ |
| 284 | - public function readRow($index): ?array |
|
| 284 | + public function readRow($index): ? array |
|
| 285 | 285 | { |
| 286 | 286 | $modelClass = $this->getModelClass(); |
| 287 | 287 | $builder = $this->getRepository() |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | |
| 306 | 306 | $deleted = $builder->execute(); |
| 307 | 307 | |
| 308 | - return (int)$deleted; |
|
| 308 | + return (int) $deleted; |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | /** |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $saveMain = $this->getRepository()->create($modelClass, $allowedChanges); |
| 321 | 321 | $saveMain = $this->builderSaveResourceOnCreate($saveMain); |
| 322 | 322 | $saveMain->getSQL(); // prepare |
| 323 | - $this->inTransaction(function () use ($modelClass, $saveMain, $toMany, &$index) { |
|
| 323 | + $this->inTransaction(function() use ($modelClass, $saveMain, $toMany, &$index) { |
|
| 324 | 324 | $saveMain->execute(); |
| 325 | 325 | // if no index given will use last insert ID as index |
| 326 | 326 | $index !== null ?: $index = $saveMain->getConnection()->lastInsertId(); |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | $saveMain = $this->getRepository()->update($modelClass, $index, $allowedChanges); |
| 354 | 354 | $saveMain = $this->builderSaveResourceOnUpdate($saveMain); |
| 355 | 355 | $saveMain->getSQL(); // prepare |
| 356 | - $this->inTransaction(function () use ($modelClass, $saveMain, $toMany, $index, &$updated) { |
|
| 356 | + $this->inTransaction(function() use ($modelClass, $saveMain, $toMany, $index, &$updated) { |
|
| 357 | 357 | $updated = $saveMain->execute(); |
| 358 | 358 | foreach ($toMany as $name => $values) { |
| 359 | 359 | $indexBind = ':index'; |
@@ -368,12 +368,12 @@ discard block |
||
| 368 | 368 | $saveToMany = $this->builderSaveRelationshipOnUpdate($name, $saveToMany); |
| 369 | 369 | $saveToMany->setParameter($indexBind, $index); |
| 370 | 370 | foreach ($values as $value) { |
| 371 | - $updated += (int)$saveToMany->setParameter($otherIndexBind, $value)->execute(); |
|
| 371 | + $updated += (int) $saveToMany->setParameter($otherIndexBind, $value)->execute(); |
|
| 372 | 372 | } |
| 373 | 373 | } |
| 374 | 374 | }); |
| 375 | 375 | |
| 376 | - return (int)$updated; |
|
| 376 | + return (int) $updated; |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | /** |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | * |
| 487 | 487 | * @return array|null |
| 488 | 488 | */ |
| 489 | - protected function fetchRow(QueryBuilder $builder, string $class): ?array |
|
| 489 | + protected function fetchRow(QueryBuilder $builder, string $class): ? array |
|
| 490 | 490 | { |
| 491 | 491 | $statement = $builder->execute(); |
| 492 | 492 | $statement->setFetchMode(PDOConnection::FETCH_ASSOC); |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | foreach ($path->getPath() as $pathPiece) { |
| 799 | 799 | $parent = $tmpPath; |
| 800 | 800 | $tmpPath = empty($tmpPath) === true ? |
| 801 | - $pathPiece : $tmpPath . static::$pathSeparator . $pathPiece; |
|
| 801 | + $pathPiece : $tmpPath.static::$pathSeparator.$pathPiece; |
|
| 802 | 802 | $normalizedPaths[$tmpPath] = [$parent, $pathPiece]; |
| 803 | 803 | $pathsDepths[$parent] = $parentDepth++; |
| 804 | 804 | } |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | // $models. |
| 850 | 850 | |
| 851 | 851 | foreach ($childRelationships as $name) { |
| 852 | - $childrenPath = $parentsPath !== static::$rootPath ? $parentsPath . static::$pathSeparator . $name : $name; |
|
| 852 | + $childrenPath = $parentsPath !== static::$rootPath ? $parentsPath.static::$pathSeparator.$name : $name; |
|
| 853 | 853 | |
| 854 | 854 | /** @var QueryBuilder $builder */ |
| 855 | 855 | list ($builder, $class, $relationshipType) = |
@@ -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; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | ): ResponseInterface { |
| 99 | 99 | assert( |
| 100 | 100 | empty(static::ON_CREATE_VALIDATION_RULES_SET_CLASS) === false, |
| 101 | - 'Validation rules set should be defined for class ' . static::class . '.' |
|
| 101 | + 'Validation rules set should be defined for class '.static::class.'.' |
|
| 102 | 102 | ); |
| 103 | 103 | |
| 104 | 104 | $captures = static::createJsonApiValidator($container, static::ON_CREATE_VALIDATION_RULES_SET_CLASS) |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $queryParser = $container->get(QueryParametersParserInterface::class); |
| 130 | 130 | $encodingParams = $queryParser->parse($request); |
| 131 | 131 | |
| 132 | - list ($filters, , $includes) = static::mapQueryParameters($container, $encodingParams, static::SCHEMA_CLASS); |
|
| 132 | + list ($filters,, $includes) = static::mapQueryParameters($container, $encodingParams, static::SCHEMA_CLASS); |
|
| 133 | 133 | |
| 134 | 134 | $index = $routeParams[static::ROUTE_KEY_INDEX]; |
| 135 | 135 | $response = static::readImpl( |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | ): ResponseInterface { |
| 154 | 154 | assert( |
| 155 | 155 | empty(static::ON_UPDATE_VALIDATION_RULES_SET_CLASS) === false, |
| 156 | - 'Validation rules set should be defined for class ' . static::class . '.' |
|
| 156 | + 'Validation rules set should be defined for class '.static::class.'.' |
|
| 157 | 157 | ); |
| 158 | 158 | |
| 159 | 159 | $captures = static::createJsonApiValidator($container, static::ON_UPDATE_VALIDATION_RULES_SET_CLASS) |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | protected static function readJsonFromRequest(ContainerInterface $container, ServerRequestInterface $request): array |
| 298 | 298 | { |
| 299 | - $body = (string)$request->getBody(); |
|
| 299 | + $body = (string) $request->getBody(); |
|
| 300 | 300 | if (empty($body) === true || ($json = json_decode($body, true)) === null) { |
| 301 | 301 | /** @var FactoryInterface $factory */ |
| 302 | 302 | $factory = $container->get(FactoryInterface::class); |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | /** @var JsonSchemesInterface $jsonSchemes */ |
| 487 | 487 | $jsonSchemes = $container->get(JsonSchemesInterface::class); |
| 488 | 488 | $targetSchema = $jsonSchemes->getRelationshipSchema(static::SCHEMA_CLASS, $relationshipName); |
| 489 | - list ($filters, $sorts, , $paging) = |
|
| 489 | + list ($filters, $sorts,, $paging) = |
|
| 490 | 490 | static::mapQueryParameters($container, $encodingParams, get_class($targetSchema)); |
| 491 | 491 | |
| 492 | 492 | /** @var SchemaInterface $schemaClass */ |
@@ -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)); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | protected function mapFilterParameters( |
| 133 | 133 | ErrorCollection $errors, |
| 134 | 134 | array $parameters = null |
| 135 | - ): ?FilterParameterCollection { |
|
| 135 | + ): ? FilterParameterCollection { |
|
| 136 | 136 | if ($parameters === null) { |
| 137 | 137 | return null; |
| 138 | 138 | } |
@@ -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 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * |
| 226 | 226 | * @SuppressWarnings(PHPMD.ElseExpression) |
| 227 | 227 | */ |
| 228 | - protected function mapFilterField(string $jsonName, $value): ?FilterParameterInterface |
|
| 228 | + protected function mapFilterField(string $jsonName, $value): ? FilterParameterInterface |
|
| 229 | 229 | { |
| 230 | 230 | $this->resetSchema(); |
| 231 | 231 | |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * |
| 275 | 275 | * @return SortParameterInterface|null |
| 276 | 276 | */ |
| 277 | - protected function mapSortField(JsonLibrarySortParameterInterface $sortParameter): ?SortParameterInterface |
|
| 277 | + protected function mapSortField(JsonLibrarySortParameterInterface $sortParameter): ? SortParameterInterface |
|
| 278 | 278 | { |
| 279 | 279 | $this->resetSchema(); |
| 280 | 280 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * |
| 303 | 303 | * @return IncludeParameterInterface|null |
| 304 | 304 | */ |
| 305 | - protected function mapRelationshipsPath(string $path): ?IncludeParameterInterface |
|
| 305 | + protected function mapRelationshipsPath(string $path): ? IncludeParameterInterface |
|
| 306 | 306 | { |
| 307 | 307 | $this->resetSchema(); |
| 308 | 308 | |