@@ -186,7 +186,7 @@ |
||
| 186 | 186 | return [static::DATA => $data->getData()]; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - $buildUrl = function ($offset) use ($data, $uri) { |
|
| 189 | + $buildUrl = function($offset) use ($data, $uri) { |
|
| 190 | 190 | $paramsWithPaging = [ |
| 191 | 191 | PaginationStrategyInterface::PARAM_PAGING_SKIP => $offset, |
| 192 | 192 | PaginationStrategyInterface::PARAM_PAGING_SIZE => $data->getLimit(), |
@@ -157,7 +157,7 @@ |
||
| 157 | 157 | { |
| 158 | 158 | parse_str($this->getOriginalUri()->getQuery(), $queryParams); |
| 159 | 159 | |
| 160 | - return function ($offset) use ($pageSize, $queryParams) { |
|
| 160 | + return function($offset) use ($pageSize, $queryParams) { |
|
| 161 | 161 | $paramsWithPaging = array_merge($queryParams, [ |
| 162 | 162 | QueryParametersParserInterface::PARAM_PAGE => [ |
| 163 | 163 | PaginationStrategyInterface::PARAM_PAGING_SKIP => $offset, |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $saveMain = $this->getRepository()->create($modelClass, $allowedChanges); |
| 324 | 324 | $saveMain = $this->builderSaveResourceOnCreate($saveMain); |
| 325 | 325 | $saveMain->getSQL(); // prepare |
| 326 | - $this->inTransaction(function () use ($modelClass, $saveMain, $toMany, &$index) { |
|
| 326 | + $this->inTransaction(function() use ($modelClass, $saveMain, $toMany, &$index) { |
|
| 327 | 327 | $saveMain->execute(); |
| 328 | 328 | // if no index given will use last insert ID as index |
| 329 | 329 | $index !== null ?: $index = $saveMain->getConnection()->lastInsertId(); |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $saveMain = $this->getRepository()->update($modelClass, $index, $allowedChanges); |
| 357 | 357 | $saveMain = $this->builderSaveResourceOnUpdate($saveMain); |
| 358 | 358 | $saveMain->getSQL(); // prepare |
| 359 | - $this->inTransaction(function () use ($modelClass, $saveMain, $toMany, $index, &$updated) { |
|
| 359 | + $this->inTransaction(function() use ($modelClass, $saveMain, $toMany, $index, &$updated) { |
|
| 360 | 360 | $updated = $saveMain->execute(); |
| 361 | 361 | foreach ($toMany as $name => $values) { |
| 362 | 362 | $indexBind = ':index'; |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | $subUri = $type = $schemeClass::TYPE; |
| 50 | 50 | |
| 51 | 51 | $indexSlug = '/{' . BaseController::ROUTE_KEY_INDEX . '}'; |
| 52 | - $params = function ($method) use ($type) { |
|
| 52 | + $params = function($method) use ($type) { |
|
| 53 | 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 | |
@@ -84,7 +84,7 @@ 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 */ |
@@ -181,8 +181,7 @@ discard block |
||
| 181 | 181 | foreach ($values as $value) { |
| 182 | 182 | $placeholders[] = $builder->createNamedParameter((string)$value); |
| 183 | 183 | } |
| 184 | - $placeholders === null ?: |
|
| 185 | - $link->add($builder->expr()->in($this->getTableColumn($table, $column), $placeholders)); |
|
| 184 | + $placeholders === null ?: $link->add($builder->expr()->in($this->getTableColumn($table, $column), $placeholders)); |
|
| 186 | 185 | } |
| 187 | 186 | |
| 188 | 187 | /** |
@@ -205,8 +204,7 @@ discard block |
||
| 205 | 204 | foreach ($values as $value) { |
| 206 | 205 | $placeholders[] = $builder->createNamedParameter((string)$value); |
| 207 | 206 | } |
| 208 | - $placeholders === null ?: |
|
| 209 | - $link->add($builder->expr()->notIn($this->getTableColumn($table, $column), $placeholders)); |
|
| 207 | + $placeholders === null ?: $link->add($builder->expr()->notIn($this->getTableColumn($table, $column), $placeholders)); |
|
| 210 | 208 | } |
| 211 | 209 | |
| 212 | 210 | /** |
@@ -47,22 +47,22 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $factory = new Factory($container); |
| 49 | 49 | |
| 50 | - $container[FactoryInterface::class] = function () use ($factory) { |
|
| 50 | + $container[FactoryInterface::class] = function() use ($factory) { |
|
| 51 | 51 | return $factory; |
| 52 | 52 | }; |
| 53 | 53 | |
| 54 | - $container[QueryParametersParserInterface::class] = function () use ($factory) { |
|
| 54 | + $container[QueryParametersParserInterface::class] = function() use ($factory) { |
|
| 55 | 55 | return $factory->getJsonApiFactory()->createQueryParametersParser(); |
| 56 | 56 | }; |
| 57 | 57 | |
| 58 | - $container[JsonSchemesInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
| 58 | + $container[JsonSchemesInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
| 59 | 59 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
| 60 | 60 | $modelSchemes = $container->get(ModelSchemeInfoInterface::class); |
| 61 | 61 | |
| 62 | 62 | return $factory->createJsonSchemes($settings[FluteSettings::KEY_MODEL_TO_SCHEME_MAP], $modelSchemes); |
| 63 | 63 | }; |
| 64 | 64 | |
| 65 | - $container[EncoderInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
| 65 | + $container[EncoderInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
| 66 | 66 | /** @var JsonSchemesInterface $jsonSchemes */ |
| 67 | 67 | $jsonSchemes = $container->get(JsonSchemesInterface::class); |
| 68 | 68 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | return $encoder; |
| 78 | 78 | }; |
| 79 | 79 | |
| 80 | - $container[FilterOperationsInterface::class] = function (PsrContainerInterface $container) { |
|
| 80 | + $container[FilterOperationsInterface::class] = function(PsrContainerInterface $container) { |
|
| 81 | 81 | return new FilterOperations($container); |
| 82 | 82 | }; |
| 83 | 83 | |
| 84 | - $container[RepositoryInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
| 84 | + $container[RepositoryInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
| 85 | 85 | $connection = $container->get(Connection::class); |
| 86 | 86 | /** @var ModelSchemeInfoInterface $modelSchemes */ |
| 87 | 87 | $modelSchemes = $container->get(ModelSchemeInfoInterface::class); |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | return $factory->createRepository($connection, $modelSchemes, $filerOps, $formatter); |
| 97 | 97 | }; |
| 98 | 98 | |
| 99 | - $container[PaginationStrategyInterface::class] = function (PsrContainerInterface $container) { |
|
| 99 | + $container[PaginationStrategyInterface::class] = function(PsrContainerInterface $container) { |
|
| 100 | 100 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
| 101 | 101 | |
| 102 | 102 | return new PaginationStrategy($settings[FluteSettings::KEY_RELATIONSHIP_PAGING_SIZE]); |
| 103 | 103 | }; |
| 104 | 104 | |
| 105 | - $container[JsonApiValidatorFactoryInterface::class] = function (PsrContainerInterface $container) { |
|
| 105 | + $container[JsonApiValidatorFactoryInterface::class] = function(PsrContainerInterface $container) { |
|
| 106 | 106 | $factory = new JsonApiValidatorFactory($container); |
| 107 | 107 | |
| 108 | 108 | return $factory; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public static function configureExceptionHandler(LimoncelloContainerInterface $container) |
| 129 | 129 | { |
| 130 | - $container[ExceptionHandlerInterface::class] = function () { |
|
| 130 | + $container[ExceptionHandlerInterface::class] = function() { |
|
| 131 | 131 | return new FluteExceptionHandler(); |
| 132 | 132 | }; |
| 133 | 133 | } |
@@ -77,8 +77,7 @@ |
||
| 77 | 77 | assert(is_scalar($index) === true && is_scalar($type) === true); |
| 78 | 78 | $expectedType = $context->getProperties()->getProperty(self::PROPERTY_RESOURCE_TYPE); |
| 79 | 79 | $reply = $type === $expectedType ? |
| 80 | - BlockReplies::createSuccessReply($index) : |
|
| 81 | - BlockReplies::createErrorReply($context, $type, ErrorCodes::INVALID_RELATIONSHIP_TYPE); |
|
| 80 | + BlockReplies::createSuccessReply($index) : BlockReplies::createErrorReply($context, $type, ErrorCodes::INVALID_RELATIONSHIP_TYPE); |
|
| 82 | 81 | |
| 83 | 82 | return $reply; |
| 84 | 83 | } |
@@ -105,8 +105,7 @@ |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $reply = $count > 0 ? |
| 108 | - BlockReplies::createSuccessReply($values) : |
|
| 109 | - BlockReplies::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
| 108 | + BlockReplies::createSuccessReply($values) : BlockReplies::createErrorReply($context, $values, ErrorCodes::EXIST_IN_DATABASE_MULTIPLE); |
|
| 110 | 109 | |
| 111 | 110 | return $reply; |
| 112 | 111 | } |
@@ -101,8 +101,7 @@ |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $reply = $count <= 0 ? |
| 104 | - BlockReplies::createSuccessReply($value) : |
|
| 105 | - BlockReplies::createErrorReply($context, $value, ErrorCodes::UNIQUE_IN_DATABASE_SINGLE); |
|
| 104 | + BlockReplies::createSuccessReply($value) : BlockReplies::createErrorReply($context, $value, ErrorCodes::UNIQUE_IN_DATABASE_SINGLE); |
|
| 106 | 105 | |
| 107 | 106 | return $reply; |
| 108 | 107 | } |