@@ -47,7 +47,7 @@ |
||
47 | 47 | $modelInstances = $builder->get(); |
48 | 48 | |
49 | 49 | return array_map( |
50 | - function ($modelInstance) use (&$resourceClass, &$mapping) { |
|
50 | + function($modelInstance) use (&$resourceClass, &$mapping) { |
|
51 | 51 | return $this->toResource($modelInstance, $resourceClass, $mapping); |
52 | 52 | }, |
53 | 53 | iterator_to_array($modelInstances) |
@@ -20,13 +20,13 @@ |
||
20 | 20 | { |
21 | 21 | if (array_key_exists('collection_resource', $context)) { |
22 | 22 | unset($context['object_to_populate']); |
23 | - return LazyCollection::make(function () use (&$data, &$format, &$context) { |
|
23 | + return LazyCollection::make(function() use (&$data, &$format, &$context) { |
|
24 | 24 | foreach ($data as $key => $value) { |
25 | 25 | yield $key => $this->serializer->denormalize($value, $context['collection_resource'], $format, $context); |
26 | 26 | } |
27 | 27 | }); |
28 | 28 | } |
29 | - return LazyCollection::make(function () use (&$data) { |
|
29 | + return LazyCollection::make(function() use (&$data) { |
|
30 | 30 | yield from $data; |
31 | 31 | }); |
32 | 32 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * apie.config: main config |
90 | 90 | */ |
91 | - $this->app->singleton('apie.config', function () { |
|
91 | + $this->app->singleton('apie.config', function() { |
|
92 | 92 | $config = $this->app->get('config'); |
93 | 93 | $res = ApieConfigResolver::resolveConfig($config->get('apie') ?? []); |
94 | 94 | $config->set('apie', $res); |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | /** |
108 | 108 | * apie.plugins: array of Apie plugins of the main apie instance. |
109 | 109 | */ |
110 | - $this->app->singleton('apie.plugins', function () { |
|
110 | + $this->app->singleton('apie.plugins', function() { |
|
111 | 111 | return $this->getPlugins(); |
112 | 112 | }); |
113 | 113 | |
114 | 114 | /** |
115 | 115 | * ApieContext::class: get all Apie instances and see which is the current Apie instance. |
116 | 116 | */ |
117 | - $this->app->singleton(ApieContext::class, function () { |
|
117 | + $this->app->singleton(ApieContext::class, function() { |
|
118 | 118 | $plugins = $this->app->get('apie.plugins'); |
119 | 119 | $debug = (bool) config('app.debug'); |
120 | 120 | $config = $this->app->get('apie.config'); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | /** |
127 | 127 | * FileStorageDataLayerContainer::class: creates FileStorageDataLayer for the right Apie instance. |
128 | 128 | */ |
129 | - $this->app->singleton(FileStorageDataLayerContainer::class, function () { |
|
129 | + $this->app->singleton(FileStorageDataLayerContainer::class, function() { |
|
130 | 130 | return new FileStorageDataLayerContainer( |
131 | 131 | storage_path('app/api-file-storage'), |
132 | 132 | $this->app->get(ApieContext::class) |
@@ -166,28 +166,28 @@ discard block |
||
166 | 166 | /** |
167 | 167 | * ApiResourcesInterface::class: get all resources of the current Apie instance. |
168 | 168 | */ |
169 | - $this->app->bind(ApiResourcesInterface::class, function () { |
|
169 | + $this->app->bind(ApiResourcesInterface::class, function() { |
|
170 | 170 | return new ApiResources($this->app->get(Apie::class)->getResources()); |
171 | 171 | }); |
172 | 172 | |
173 | 173 | /** |
174 | 174 | * ApiResourcePersister: call the correct data layer persist functionality. |
175 | 175 | */ |
176 | - $this->app->bind(ApiResourcePersister::class, function () { |
|
176 | + $this->app->bind(ApiResourcePersister::class, function() { |
|
177 | 177 | return new ApiResourcePersister($this->app->get(Apie::class)->getApiResourceMetadataFactory()); |
178 | 178 | }); |
179 | 179 | |
180 | 180 | /** |
181 | 181 | * ApiResourcePersister: call the correct data layer retrieve functionality. |
182 | 182 | */ |
183 | - $this->app->bind(ApiResourceRetriever::class, function () { |
|
183 | + $this->app->bind(ApiResourceRetriever::class, function() { |
|
184 | 184 | return new ApiResourceRetriever($this->app->get(Apie::class)->getApiResourceMetadataFactory()); |
185 | 185 | }); |
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Apie::class: current Apie instance. |
189 | 189 | */ |
190 | - $this->app->bind(Apie::class, function () { |
|
190 | + $this->app->bind(Apie::class, function() { |
|
191 | 191 | /** @var ApieContext $context */ |
192 | 192 | $context = $this->app->get(ApieContext::class)->getActiveContext(); |
193 | 193 | return $context->getApie(); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | /** |
197 | 197 | * IlluminatePlugin::class: current IlluminatePlugin instance |
198 | 198 | */ |
199 | - $this->app->bind(IlluminatePlugin::class, function () { |
|
199 | + $this->app->bind(IlluminatePlugin::class, function() { |
|
200 | 200 | /** @var Apie $apie */ |
201 | 201 | $apie = $this->app->get(Apie::class); |
202 | 202 | return $apie->getPlugin(IlluminatePlugin::class); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | /** |
206 | 206 | * ApplicationInfoRetriever::class: get retriever for Application Info of current apie instance. |
207 | 207 | */ |
208 | - $this->app->bind(ApplicationInfoRetriever::class, function () { |
|
208 | + $this->app->bind(ApplicationInfoRetriever::class, function() { |
|
209 | 209 | /** @var IlluminatePlugin $laravelPlugin */ |
210 | 210 | $laravelPlugin = $this->app->get(IlluminatePlugin::class); |
211 | 211 | $config = $laravelPlugin->getLaravelConfig(); |
@@ -220,14 +220,14 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * FileStorageDataLayer::class: get file storage data layer for current apie instance. |
222 | 222 | */ |
223 | - $this->app->bind(FileStorageDataLayer::class, function () { |
|
223 | + $this->app->bind(FileStorageDataLayer::class, function() { |
|
224 | 224 | return $this->app->get(FileStorageDataLayerContainer::class)->getCurrentFileStorageDataLayer(); |
225 | 225 | }); |
226 | 226 | |
227 | 227 | /** |
228 | 228 | * ApieExceptionToResponse::class: converts exception to an Apie response. |
229 | 229 | */ |
230 | - $this->app->bind(ApieExceptionToResponse::class, function () { |
|
230 | + $this->app->bind(ApieExceptionToResponse::class, function() { |
|
231 | 231 | /** @var IlluminatePlugin $laravelPlugin */ |
232 | 232 | $laravelPlugin = $this->app->get(IlluminatePlugin::class); |
233 | 233 | $config = $laravelPlugin->getLaravelConfig(); |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | /** |
239 | 239 | * Serializer::class: gets the Symfony serializer. |
240 | 240 | */ |
241 | - $this->app->bind(Serializer::class, function () { |
|
241 | + $this->app->bind(Serializer::class, function() { |
|
242 | 242 | $serializer = $this->app->get(ResourceSerializerInterface::class); |
243 | - if (! ($serializer instanceof SymfonySerializerAdapter)) { |
|
243 | + if (!($serializer instanceof SymfonySerializerAdapter)) { |
|
244 | 244 | throw new InvalidClassTypeException('resource serializer', SymfonySerializerAdapter::class); |
245 | 245 | } |
246 | 246 | return $serializer->getSerializer(); |
@@ -264,18 +264,18 @@ discard block |
||
264 | 264 | |
265 | 265 | private function registerApieService(string $serviceName, string $methodName) |
266 | 266 | { |
267 | - $this->app->bind($serviceName, function () use ($methodName) { |
|
267 | + $this->app->bind($serviceName, function() use ($methodName) { |
|
268 | 268 | return $this->app->get(Apie::class)->$methodName(); |
269 | 269 | }); |
270 | 270 | } |
271 | 271 | |
272 | 272 | private function addStatusResourceServices() |
273 | 273 | { |
274 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
274 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
275 | 275 | return new StatusFromDatabaseRetriever(config('app.debug')); |
276 | 276 | }); |
277 | 277 | $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']); |
278 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
278 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
279 | 279 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
280 | 280 | }); |
281 | 281 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | private function registerResourceClass(string $apiName, string $resourceClass) |
32 | 32 | { |
33 | - $this->app->bind($resourceClass, function () use ($resourceClass, $apiName) { |
|
33 | + $this->app->bind($resourceClass, function() use ($resourceClass, $apiName) { |
|
34 | 34 | /** @var ServerRequestInterface $request */ |
35 | 35 | $request = $this->app->get(ServerRequestInterface::class); |
36 | 36 |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | $context->getContextKey(), |
29 | 29 | $context->getConfig('api-url'), |
30 | 30 | $context->getConfig('swagger-ui-test-page-middleware'), |
31 | - function () use ($context) { |
|
31 | + function() use ($context) { |
|
32 | 32 | $this->routeLoader->addDocUrl($context->getContextKey()); |
33 | 33 | } |
34 | 34 | ); |
35 | 35 | $middleware = $context->getConfig('apie-middleware'); |
36 | 36 | if ($context->getConfig('translations')) { |
37 | - array_unshift($middleware, HandleAcceptLanguage::class. ':' . implode(',', $context->getConfig('translations'))); |
|
37 | + array_unshift($middleware, HandleAcceptLanguage::class . ':' . implode(',', $context->getConfig('translations'))); |
|
38 | 38 | } |
39 | 39 | $this->routeLoader->context( |
40 | 40 | $context->getContextKey(), |
41 | 41 | $context->getConfig('api-url'), |
42 | 42 | $middleware, |
43 | - function () use ($context) { |
|
43 | + function() use ($context) { |
|
44 | 44 | $this->routeLoader->addResourceUrl($context->getContextKey()); |
45 | 45 | } |
46 | 46 | ); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $context->getContextKey(), |
50 | 50 | $context->getConfig('swagger-ui-test-page'), |
51 | 51 | $context->getConfig('swagger-ui-test-page-middleware'), |
52 | - function () use ($context) { |
|
52 | + function() use ($context) { |
|
53 | 53 | $this->routeLoader->addSwaggerUiUrl($context->getContextKey()); |
54 | 54 | } |
55 | 55 | ); |