@@ -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(); |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // if relationship is `belongs-to` and has that ID we can add relationship as identifier |
| 159 | - $modelClass = get_class($model); |
|
| 159 | + $modelClass = get_class($model); |
|
| 160 | 160 | $relType = $this->getModelSchemas()->getRelationshipType($modelClass, $modelRelName); |
| 161 | 161 | if ($relType === RelationshipTypes::BELONGS_TO) { |
| 162 | 162 | $fkName = $this->getModelSchemas()->getForeignKey($modelClass, $modelRelName); |
| 163 | 163 | if ($this->hasProperty($model, $fkName) === true) { |
| 164 | - $reverseIndex = $model->{$fkName}; |
|
| 164 | + $reverseIndex = $model->{$fkName}; |
|
| 165 | 165 | if ($reverseIndex === null) { |
| 166 | 166 | $identifier = null; |
| 167 | 167 | } else { |
@@ -247,14 +247,14 @@ discard block |
||
| 247 | 247 | // if we are here then relationship contains paginated data, so we have to add pagination links |
| 248 | 248 | $offset = $relationshipData->getOffset(); |
| 249 | 249 | $limit = $relationshipData->getLimit(); |
| 250 | - $urlPrefix = $this->getRelationshipSelfSubUrl($model, $jsonRelName) . '?'; |
|
| 251 | - $buildLink = function (int $offset, int $limit) use ($urlPrefix) : LinkInterface { |
|
| 250 | + $urlPrefix = $this->getRelationshipSelfSubUrl($model, $jsonRelName).'?'; |
|
| 251 | + $buildLink = function(int $offset, int $limit) use ($urlPrefix) : LinkInterface { |
|
| 252 | 252 | $paramsWithPaging = [ |
| 253 | 253 | JsonApiQueryParserInterface::PARAM_PAGING_OFFSET => $offset, |
| 254 | 254 | JsonApiQueryParserInterface::PARAM_PAGING_LIMIT => $limit, |
| 255 | 255 | ]; |
| 256 | 256 | |
| 257 | - $subUrl = $urlPrefix . http_build_query($paramsWithPaging); |
|
| 257 | + $subUrl = $urlPrefix.http_build_query($paramsWithPaging); |
|
| 258 | 258 | |
| 259 | 259 | return $this->getFactory()->createLink(true, $subUrl, false); |
| 260 | 260 | }; |
@@ -304,6 +304,6 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | private function getRelationshipSelfSubUrl(ModelInterface $model, string $jsonRelName): string |
| 306 | 306 | { |
| 307 | - return $this->getSelfSubUrl($model) . '/relationships/' . $jsonRelName; |
|
| 307 | + return $this->getSelfSubUrl($model).'/relationships/'.$jsonRelName; |
|
| 308 | 308 | } |
| 309 | 309 | } |
@@ -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 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | $schema = $jsonSchemas->getSchema($model); |
| 322 | 322 | $selfLink = $schema->getSelfLink($model); |
| 323 | - $urlPrefix = (string)$requestUri->withPath('')->withQuery('')->withFragment(''); |
|
| 323 | + $urlPrefix = (string) $requestUri->withPath('')->withQuery('')->withFragment(''); |
|
| 324 | 324 | $fullUrl = $selfLink->getStringRepresentation($urlPrefix); |
| 325 | 325 | |
| 326 | 326 | $responses = static::defaultCreateResponses($requestUri, $encoder); |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | $modelClass = $schemaClass::MODEL; |
| 651 | 651 | assert($schemaInfo->hasRelationship($modelClass, $modelRelName)); |
| 652 | 652 | assert( |
| 653 | - ($type =$schemaInfo->getRelationshipType($modelClass, $modelRelName)) === RelationshipTypes::BELONGS_TO || |
|
| 653 | + ($type = $schemaInfo->getRelationshipType($modelClass, $modelRelName)) === RelationshipTypes::BELONGS_TO || |
|
| 654 | 654 | $type === RelationshipTypes::BELONGS_TO_MANY |
| 655 | 655 | ); |
| 656 | 656 | |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | */ |
| 900 | 900 | private static function assertClassValueDefined(?string $value): void |
| 901 | 901 | { |
| 902 | - assert(empty($value) === false, 'Value should be defined in `' . static::class . '`.'); |
|
| 902 | + assert(empty($value) === false, 'Value should be defined in `'.static::class.'`.'); |
|
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | /** |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | { |
| 913 | 913 | assert( |
| 914 | 914 | array_key_exists($interface, class_implements($class)) === true, |
| 915 | - "Class `$class` should implement `" . $interface . '` interface.' |
|
| 915 | + "Class `$class` should implement `".$interface.'` interface.' |
|
| 916 | 916 | ); |
| 917 | 917 | } |
| 918 | 918 | } |