@@ -99,7 +99,7 @@ |
||
99 | 99 | $details = null; |
100 | 100 | if ($this->isDebug === true) { |
101 | 101 | $message = $throwable->getMessage(); |
102 | - $details = (string)$throwable; |
|
102 | + $details = (string) $throwable; |
|
103 | 103 | } |
104 | 104 | $errors->add(new Error(null, null, $httpCode, null, $message, $details)); |
105 | 105 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | parse_str($this->getOriginalUri()->getQuery(), $queryParams); |
127 | 127 | |
128 | - return function ($offset) use ($pageSize, $queryParams) { |
|
128 | + return function($offset) use ($pageSize, $queryParams) { |
|
129 | 129 | $paramsWithPaging = array_merge($queryParams, [ |
130 | 130 | QueryParametersParserInterface::PARAM_PAGE => [ |
131 | 131 | PaginationStrategyInterface::PARAM_PAGING_SKIP => $offset, |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | ], |
134 | 134 | ]); |
135 | 135 | $newUri = $this->getOriginalUri()->withQuery(http_build_query($paramsWithPaging)); |
136 | - $fullUrl = (string)$newUri; |
|
136 | + $fullUrl = (string) $newUri; |
|
137 | 137 | $link = $this->getFactory()->createLink($fullUrl, null, true); |
138 | 138 | |
139 | 139 | return $link; |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | assert(array_key_exists(SchemaInterface::class, class_implements($schemeClass)) === true); |
54 | 54 | $type = $schemeClass::TYPE; |
55 | 55 | |
56 | - $indexSlug = '/{' . CI::ROUTE_KEY_INDEX . '}'; |
|
57 | - $params = function ($method) use ($type) { |
|
58 | - return [RouteInterface::PARAM_NAME => $type . '_' . $method]; |
|
56 | + $indexSlug = '/{'.CI::ROUTE_KEY_INDEX.'}'; |
|
57 | + $params = function($method) use ($type) { |
|
58 | + return [RouteInterface::PARAM_NAME => $type.'_'.$method]; |
|
59 | 59 | }; |
60 | - $handler = function ($method) use ($controllerClass) { |
|
60 | + $handler = function($method) use ($controllerClass) { |
|
61 | 61 | return [$controllerClass, $method]; |
62 | 62 | }; |
63 | 63 | |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | $group->post($type, $handler(CI::METHOD_CREATE), $params(CI::METHOD_CREATE)); |
71 | 71 | } |
72 | 72 | if (in_array(ControllerReadInterface::class, $classInterfaces) === true) { |
73 | - $group->get($type . $indexSlug, $handler(CI::METHOD_READ), $params(CI::METHOD_READ)); |
|
73 | + $group->get($type.$indexSlug, $handler(CI::METHOD_READ), $params(CI::METHOD_READ)); |
|
74 | 74 | } |
75 | 75 | if (in_array(ControllerUpdateInterface::class, $classInterfaces) === true) { |
76 | - $group->patch($type . $indexSlug, $handler(CI::METHOD_UPDATE), $params(CI::METHOD_UPDATE)); |
|
76 | + $group->patch($type.$indexSlug, $handler(CI::METHOD_UPDATE), $params(CI::METHOD_UPDATE)); |
|
77 | 77 | } |
78 | 78 | if (in_array(ControllerDeleteInterface::class, $classInterfaces) === true) { |
79 | - $group->delete($type . $indexSlug, $handler(CI::METHOD_DELETE), $params(CI::METHOD_DELETE)); |
|
79 | + $group->delete($type.$indexSlug, $handler(CI::METHOD_DELETE), $params(CI::METHOD_DELETE)); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | return $group; |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | */ |
92 | 92 | protected static function controller(GroupInterface $group, string $subUri, string $controllerClass): GroupInterface |
93 | 93 | { |
94 | - $slugged = $subUri . '/{' . CI::ROUTE_KEY_INDEX . '}'; |
|
95 | - $params = function ($method) use ($subUri) { |
|
96 | - return [RouteInterface::PARAM_NAME => $subUri . '_' . $method]; |
|
94 | + $slugged = $subUri.'/{'.CI::ROUTE_KEY_INDEX.'}'; |
|
95 | + $params = function($method) use ($subUri) { |
|
96 | + return [RouteInterface::PARAM_NAME => $subUri.'_'.$method]; |
|
97 | 97 | }; |
98 | - $handler = function ($method) use ($controllerClass) { |
|
98 | + $handler = function($method) use ($controllerClass) { |
|
99 | 99 | return [$controllerClass, $method]; |
100 | 100 | }; |
101 | 101 | |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | $group->get($slugged, $handler(CI::METHOD_READ), $params(CI::METHOD_READ)); |
113 | 113 | } |
114 | 114 | if (in_array(ControllerUpdateInterface::class, $classInterfaces) === true) { |
115 | - $updateUri = $slugged . '/' . CI::METHOD_UPDATE; |
|
115 | + $updateUri = $slugged.'/'.CI::METHOD_UPDATE; |
|
116 | 116 | $group->post($updateUri, $handler(CI::METHOD_UPDATE), $params(CI::METHOD_UPDATE)); |
117 | 117 | } |
118 | 118 | if (in_array(ControllerDeleteInterface::class, $classInterfaces) === true) { |
119 | - $deleteUri = $slugged . '/' . CI::METHOD_DELETE; |
|
119 | + $deleteUri = $slugged.'/'.CI::METHOD_DELETE; |
|
120 | 120 | $group->post($deleteUri, $handler(CI::METHOD_DELETE), $params(CI::METHOD_DELETE)); |
121 | 121 | } |
122 | 122 | |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | /** @var string $controllerClass */ |
149 | 149 | /** @var string $schemaClass */ |
150 | 150 | |
151 | - $resourceIdUri = $subUri . '/{' . CI::ROUTE_KEY_INDEX . '}/'; |
|
152 | - $selfUri = $resourceIdUri . DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $relationshipName; |
|
151 | + $resourceIdUri = $subUri.'/{'.CI::ROUTE_KEY_INDEX.'}/'; |
|
152 | + $selfUri = $resourceIdUri.DocumentInterface::KEYWORD_RELATIONSHIPS.'/'.$relationshipName; |
|
153 | 153 | |
154 | 154 | return $group |
155 | 155 | // `self` |
156 | 156 | ->get($selfUri, [$controllerClass, $selfGetMethod]) |
157 | 157 | // `related` |
158 | - ->get($resourceIdUri . $relationshipName, [$controllerClass, $selfGetMethod]); |
|
158 | + ->get($resourceIdUri.$relationshipName, [$controllerClass, $selfGetMethod]); |
|
159 | 159 | } |
160 | 160 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * @inheritdoc |
70 | 70 | */ |
71 | - public function parseParameters(?array $parameters): array |
|
71 | + public function parseParameters(? array $parameters) : array |
|
72 | 72 | { |
73 | 73 | if ($parameters === null) { |
74 | 74 | return [0, $this->getDefaultPageSize()]; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | 0, |
82 | 82 | PHP_INT_MAX |
83 | 83 | ); |
84 | - $size = $this->getValue( |
|
84 | + $size = $this->getValue( |
|
85 | 85 | $parameters, |
86 | 86 | static::PARAM_PAGING_SIZE, |
87 | 87 | $this->getDefaultPageSize(), |
@@ -208,12 +208,12 @@ |
||
208 | 208 | return [static::DATA => $data->getData()]; |
209 | 209 | } |
210 | 210 | |
211 | - $buildUrl = function ($offset) use ($data, $uri) { |
|
211 | + $buildUrl = function($offset) use ($data, $uri) { |
|
212 | 212 | $paramsWithPaging = [ |
213 | 213 | PaginationStrategyInterface::PARAM_PAGING_SKIP => $offset, |
214 | 214 | PaginationStrategyInterface::PARAM_PAGING_SIZE => $data->getLimit(), |
215 | 215 | ]; |
216 | - $fullUrl = $uri . '?' . http_build_query($paramsWithPaging); |
|
216 | + $fullUrl = $uri.'?'.http_build_query($paramsWithPaging); |
|
217 | 217 | |
218 | 218 | return $fullUrl; |
219 | 219 | }; |
@@ -108,8 +108,8 @@ |
||
108 | 108 | ); |
109 | 109 | assert(empty($validatorsFileMask) === false, "Invalid Validators file mask `$validatorsFileMask`."); |
110 | 110 | |
111 | - $schemesPath = $schemesFolder . DIRECTORY_SEPARATOR . $schemesFileMask; |
|
112 | - $validatorsPath = $validatorsFolder . DIRECTORY_SEPARATOR . $validatorsFileMask; |
|
111 | + $schemesPath = $schemesFolder.DIRECTORY_SEPARATOR.$schemesFileMask; |
|
112 | + $validatorsPath = $validatorsFolder.DIRECTORY_SEPARATOR.$validatorsFileMask; |
|
113 | 113 | |
114 | 114 | $requireUniqueTypes = $defaults[static::KEY_SCHEMES_REQUIRE_UNIQUE_TYPES] ?? true; |
115 | 115 |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | public function getMappedIncludes(): iterable |
246 | 246 | { |
247 | 247 | $fromScheme = $this->getRootScheme(); |
248 | - $getMappedRelLinks = function (iterable $links) use ($fromScheme) : iterable { |
|
248 | + $getMappedRelLinks = function(iterable $links) use ($fromScheme) : iterable { |
|
249 | 249 | foreach ($links as $link) { |
250 | 250 | assert(is_string($link)); |
251 | 251 | $fromSchemaClass = get_class($fromScheme); |
@@ -289,14 +289,14 @@ discard block |
||
289 | 289 | // ['rel2_name1', ], |
290 | 290 | // ['rel3_name1', 'rel3_name2', 'rel3_name3', ], |
291 | 291 | // ] |
292 | - $includeAsModelNames = function (iterable $relationships): iterable { |
|
292 | + $includeAsModelNames = function(iterable $relationships): iterable { |
|
293 | 293 | foreach ($relationships as $relationship) { |
294 | 294 | assert($relationship instanceof RelationshipInterface); |
295 | 295 | yield $relationship->getNameInModel(); |
296 | 296 | } |
297 | 297 | }; |
298 | - $mappedIncludes = $this->getMappedIncludes(); |
|
299 | - $getIncludes = function () use ($mappedIncludes, $includeAsModelNames) : iterable { |
|
298 | + $mappedIncludes = $this->getMappedIncludes(); |
|
299 | + $getIncludes = function() use ($mappedIncludes, $includeAsModelNames) : iterable { |
|
300 | 300 | foreach ($mappedIncludes as $relationships) { |
301 | 301 | yield $includeAsModelNames($relationships); |
302 | 302 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | public function __construct(array $parameters = [], array $messages = null) |
49 | 49 | { |
50 | 50 | $this->setParameters($parameters); |
51 | - $this->messages = $messages; |
|
51 | + $this->messages = $messages; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | public function getIncludes(): iterable |
70 | 70 | { |
71 | 71 | if (array_key_exists(static::PARAM_INCLUDE, $this->getParameters()) === true) { |
72 | - $splitByDot = function (string $path): iterable { |
|
72 | + $splitByDot = function(string $path): iterable { |
|
73 | 73 | foreach ($this->splitStringAndCheckNoEmpties(static::PARAM_INCLUDE, $path, '.') as $link) { |
74 | 74 | yield $link; |
75 | 75 | } |
76 | 76 | }; |
77 | 77 | |
78 | - $includes = $this->getParameters()[static::PARAM_INCLUDE]; |
|
78 | + $includes = $this->getParameters()[static::PARAM_INCLUDE]; |
|
79 | 79 | foreach ($this->splitCommaSeparatedStringAndCheckNoEmpties(static::PARAM_INCLUDE, $includes) as $path) { |
80 | 80 | yield $path => $splitByDot($path); |
81 | 81 | } |
@@ -49,22 +49,22 @@ discard block |
||
49 | 49 | |
50 | 50 | $container[FactoryInterface::class] = $factory; |
51 | 51 | |
52 | - $container[JsonSchemesInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
52 | + $container[JsonSchemesInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
53 | 53 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
54 | 54 | $modelSchemes = $container->get(ModelSchemeInfoInterface::class); |
55 | 55 | |
56 | 56 | return $factory->createJsonSchemes($settings[FluteSettings::KEY_MODEL_TO_SCHEME_MAP], $modelSchemes); |
57 | 57 | }; |
58 | 58 | |
59 | - $container[QueryParserInterface::class] = function (PsrContainerInterface $container) { |
|
59 | + $container[QueryParserInterface::class] = function(PsrContainerInterface $container) { |
|
60 | 60 | return new QueryParser($container->get(PaginationStrategyInterface::class)); |
61 | 61 | }; |
62 | 62 | |
63 | - $container[ParametersMapperInterface::class] = function (PsrContainerInterface $container) { |
|
63 | + $container[ParametersMapperInterface::class] = function(PsrContainerInterface $container) { |
|
64 | 64 | return new ParametersMapper($container->get(JsonSchemesInterface::class)); |
65 | 65 | }; |
66 | 66 | |
67 | - $container[EncoderInterface::class] = function (PsrContainerInterface $container) use ($factory) { |
|
67 | + $container[EncoderInterface::class] = function(PsrContainerInterface $container) use ($factory) { |
|
68 | 68 | /** @var JsonSchemesInterface $jsonSchemes */ |
69 | 69 | $jsonSchemes = $container->get(JsonSchemesInterface::class); |
70 | 70 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return $encoder; |
80 | 80 | }; |
81 | 81 | |
82 | - $container[PaginationStrategyInterface::class] = function (PsrContainerInterface $container) { |
|
82 | + $container[PaginationStrategyInterface::class] = function(PsrContainerInterface $container) { |
|
83 | 83 | $settings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
84 | 84 | |
85 | 85 | return new PaginationStrategy( |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ); |
89 | 89 | }; |
90 | 90 | |
91 | - $container[JsonApiValidatorFactoryInterface::class] = function (PsrContainerInterface $container) { |
|
91 | + $container[JsonApiValidatorFactoryInterface::class] = function(PsrContainerInterface $container) { |
|
92 | 92 | $factory = new JsonApiValidatorFactory($container); |
93 | 93 | |
94 | 94 | return $factory; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public static function configureExceptionHandler(LimoncelloContainerInterface $container) |
118 | 118 | { |
119 | - $container[ThrowableHandlerInterface::class] = function (PsrContainerInterface $container) { |
|
119 | + $container[ThrowableHandlerInterface::class] = function(PsrContainerInterface $container) { |
|
120 | 120 | $appSettings = $container->get(SettingsProviderInterface::class)->get(A::class); |
121 | 121 | $fluteSettings = $container->get(SettingsProviderInterface::class)->get(FluteSettings::class); |
122 | 122 |