@@ -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(), |
@@ -343,7 +343,7 @@ |
||
| 343 | 343 | $attributeRules = $this->getRules()[static::RULE_ATTRIBUTES] ?? []; |
| 344 | 344 | $schema = $this->getSchema(); |
| 345 | 345 | $attributeTypes = $this->getModelSchemes()->getAttributeTypes($schema::MODEL); |
| 346 | - $createTypedCapture = function (string $name, RuleInterface $rule) use ($attributeTypes, $schema) { |
|
| 346 | + $createTypedCapture = function(string $name, RuleInterface $rule) use ($attributeTypes, $schema) { |
|
| 347 | 347 | $captureName = $schema->getAttributeMapping($name); |
| 348 | 348 | $attributeType = $attributeTypes[$captureName] ?? Type::STRING; |
| 349 | 349 | $untypedCapture = static::singleCapture($captureName, $rule, $this->getCaptureAggregator()); |
@@ -46,22 +46,22 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $factory = new Factory($container); |
| 48 | 48 | |
| 49 | - $container[FactoryInterface::class] = function () use ($factory) { |
|
| 49 | + $container[FactoryInterface::class] = function() use ($factory) { |
|
| 50 | 50 | return $factory; |
| 51 | 51 | }; |
| 52 | 52 | |
| 53 | - $container[QueryParametersParserInterface::class] = function () use ($factory) { |
|
| 53 | + $container[QueryParametersParserInterface::class] = function() use ($factory) { |
|
| 54 | 54 | return $factory->getJsonApiFactory()->createQueryParametersParser(); |
| 55 | 55 | }; |
| 56 | 56 | |
| 57 | - $container[JsonSchemesInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
| 57 | + $container[JsonSchemesInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
| 58 | 58 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
| 59 | 59 | $modelSchemes = $container->get(ModelSchemeInfoInterface::class); |
| 60 | 60 | |
| 61 | 61 | return $factory->createJsonSchemes($settings[FluteSettings::KEY_MODEL_TO_SCHEME_MAP], $modelSchemes); |
| 62 | 62 | }; |
| 63 | 63 | |
| 64 | - $container[EncoderInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
| 64 | + $container[EncoderInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
| 65 | 65 | /** @var JsonSchemesInterface $jsonSchemes */ |
| 66 | 66 | $jsonSchemes = $container->get(JsonSchemesInterface::class); |
| 67 | 67 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $settings[FluteSettings::KEY_URI_PREFIX], |
| 71 | 71 | $settings[FluteSettings::KEY_JSON_ENCODE_DEPTH] |
| 72 | 72 | )); |
| 73 | - isset($settings[FluteSettings::KEY_META]) ? $encoder->withMeta($settings[FluteSettings::KEY_META]): null; |
|
| 73 | + isset($settings[FluteSettings::KEY_META]) ? $encoder->withMeta($settings[FluteSettings::KEY_META]) : null; |
|
| 74 | 74 | ($settings[FluteSettings::KEY_IS_SHOW_VERSION] ?? false) ? $encoder->withJsonApiVersion() : null; |
| 75 | 75 | |
| 76 | 76 | return $encoder; |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | $container[TranslatorInterface::class] = $translator = $factory->createTranslator(); |
| 80 | 80 | $container[FilterOperationsInterface::class] = $filerOps = new FilterOperations($translator); |
| 81 | 81 | |
| 82 | - $container[ValidationTranslatorInterface::class] = function () { |
|
| 82 | + $container[ValidationTranslatorInterface::class] = function() { |
|
| 83 | 83 | // TODO load locale according to current user preferences |
| 84 | 84 | return new Translator(EnUsLocale::getLocaleCode(), EnUsLocale::getMessages()); |
| 85 | 85 | }; |
| 86 | 86 | |
| 87 | - $container[RepositoryInterface::class] = function (PsrContainerInterface $container) use ( |
|
| 87 | + $container[RepositoryInterface::class] = function(PsrContainerInterface $container) use ( |
|
| 88 | 88 | $factory, |
| 89 | 89 | $filerOps, |
| 90 | 90 | $translator |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | return $factory->createRepository($connection, $modelSchemes, $filerOps, $translator); |
| 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]); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public static function configureExceptionHandler(LimoncelloContainerInterface $container) |
| 120 | 120 | { |
| 121 | - $container[ExceptionHandlerInterface::class] = function () { |
|
| 121 | + $container[ExceptionHandlerInterface::class] = function() { |
|
| 122 | 122 | return new FluteExceptionHandler(); |
| 123 | 123 | }; |
| 124 | 124 | } |
@@ -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'; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $queryParser = $container->get(QueryParametersParserInterface::class); |
| 105 | 105 | $encodingParams = $queryParser->parse($request); |
| 106 | 106 | |
| 107 | - list ($filters, , $includes) = static::mapQueryParameters($container, $encodingParams, static::SCHEMA_CLASS); |
|
| 107 | + list ($filters,, $includes) = static::mapQueryParameters($container, $encodingParams, static::SCHEMA_CLASS); |
|
| 108 | 108 | |
| 109 | 109 | $index = $routeParams[static::ROUTE_KEY_INDEX]; |
| 110 | 110 | $modelData = self::createApi($container)->read($index, $filters, $includes); |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | /** @var JsonSchemesInterface $jsonSchemes */ |
| 378 | 378 | $jsonSchemes = $container->get(JsonSchemesInterface::class); |
| 379 | 379 | $targetSchema = $jsonSchemes->getRelationshipSchema(static::SCHEMA_CLASS, $relationshipName); |
| 380 | - list ($filters, $sorts, , $paging) = |
|
| 380 | + list ($filters, $sorts,, $paging) = |
|
| 381 | 381 | static::mapQueryParameters($container, $encodingParams, get_class($targetSchema)); |
| 382 | 382 | |
| 383 | 383 | /** @var SchemaInterface $schemaClass */ |
@@ -235,7 +235,7 @@ |
||
| 235 | 235 | $mappedParam = $this->createFilterAttributeParameter($jsonName, $column, $value); |
| 236 | 236 | } elseif ($this->canMapRelationship($jsonName) === true) { |
| 237 | 237 | $modelName = $this->getRelationshipMappings()[$jsonName]; |
| 238 | - $type = $this->getModelSchemes()->getRelationshipType($this->getCurrentModelClass(), $modelName); |
|
| 238 | + $type = $this->getModelSchemes()->getRelationshipType($this->getCurrentModelClass(), $modelName); |
|
| 239 | 239 | $mappedParam = $this->createFilterRelationshipParameter($jsonName, $modelName, $value, $type); |
| 240 | 240 | } else { |
| 241 | 241 | // filters could actually be applied to attributes in relationships |
@@ -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 */ |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $table = $this->getTableName($modelClass); |
| 288 | 288 | foreach ($sortParams as $sortParam) { |
| 289 | 289 | /** @var SortParameterInterface $sortParam */ |
| 290 | - $column = null; |
|
| 290 | + $column = null; |
|
| 291 | 291 | if ($sortParam->isRelationship() === false) { |
| 292 | 292 | $column = $sortParam->getName(); |
| 293 | 293 | } elseif ($sortParam->getRelationshipType() === RelationshipTypes::BELONGS_TO) { |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | switch ($filterParam->getRelationshipType()) { |
| 358 | 358 | case RelationshipTypes::BELONGS_TO: |
| 359 | 359 | if ($filterParam->isForAttributeInRelationship() === true) { |
| 360 | - $foreignKey = $modelSchemes->getForeignKey( |
|
| 360 | + $foreignKey = $modelSchemes->getForeignKey( |
|
| 361 | 361 | $modelClass, |
| 362 | 362 | $filterParam->getRelationshipName() |
| 363 | 363 | ); |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | break; |
| 415 | 415 | case RelationshipTypes::BELONGS_TO_MANY: |
| 416 | 416 | // here we join intermediate belongsToMany table and apply filter on its 2nd foreign key |
| 417 | - list ($intermediateTable, $intermediatePk , $intermediateFk) = $modelSchemes |
|
| 417 | + list ($intermediateTable, $intermediatePk, $intermediateFk) = $modelSchemes |
|
| 418 | 418 | ->getBelongsToManyRelationship($modelClass, $filterParam->getRelationshipName()); |
| 419 | 419 | $primaryKey = $modelSchemes->getPrimaryKey($modelClass); |
| 420 | 420 | $aliased = $intermediateTable . $this->getNewAliasId(); |