@@ -84,7 +84,7 @@ |
||
84 | 84 | * @see ApiResource |
85 | 85 | */ |
86 | 86 | 'resource-config' => [ |
87 | - /*ApplicationInfo::class => ['retrieveClass' => StatusCheckRetriever::class],*/ |
|
87 | + /*ApplicationInfo::class => ['retrieveClass' => StatusCheckRetriever::class],*/ |
|
88 | 88 | ], |
89 | 89 | |
90 | 90 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $context->getContextKey(), |
27 | 27 | $context->getConfig('api-url'), |
28 | 28 | $context->getConfig('swagger-ui-test-page-middleware'), |
29 | - function () use ($context) { |
|
29 | + function() use ($context) { |
|
30 | 30 | $this->routeLoader->addDocUrl($context->getContextKey()); |
31 | 31 | } |
32 | 32 | ); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $context->getContextKey(), |
35 | 35 | $context->getConfig('api-url'), |
36 | 36 | $context->getConfig('apie-middleware'), |
37 | - function () use ($context) { |
|
37 | + function() use ($context) { |
|
38 | 38 | $this->routeLoader->addResourceUrl($context->getContextKey()); |
39 | 39 | } |
40 | 40 | ); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $context->getContextKey(), |
44 | 44 | $context->getConfig('swagger-ui-test-page'), |
45 | 45 | $context->getConfig('swagger-ui-test-page-middleware'), |
46 | - function () use ($context) { |
|
46 | + function() use ($context) { |
|
47 | 47 | $this->routeLoader->addSwaggerUiUrl($context->getContextKey()); |
48 | 48 | } |
49 | 49 | ); |
@@ -56,7 +56,7 @@ |
||
56 | 56 | 'prefix' => $prefix, |
57 | 57 | 'middleware' => $middleware |
58 | 58 | ], |
59 | - function () use ($closure, &$context) { |
|
59 | + function() use ($closure, &$context) { |
|
60 | 60 | $closure($context); |
61 | 61 | } |
62 | 62 | ); |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $router = app('router'); |
61 | 61 | $router->group( |
62 | 62 | ['parameters' => ['context' => $context], 'prefix' => $prefix, 'middleware' => $middleware], |
63 | - function () use ($closure) { |
|
63 | + function() use ($closure) { |
|
64 | 64 | $closure(); |
65 | 65 | } |
66 | 66 | ); |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | ->setAllowedTypes('metadata', 'string[]') |
53 | 53 | ->setAllowedTypes('resource-config', [ApiResource::class . '[]', 'array[]']) |
54 | 54 | ->setAllowedTypes('exception-mapping', 'int[]'); |
55 | - $resolver->setDefault('metadata', function (OptionsResolver $metadataResolver) use (&$defaults) { |
|
55 | + $resolver->setDefault('metadata', function(OptionsResolver $metadataResolver) use (&$defaults) { |
|
56 | 56 | $metadataResolver->setDefaults($defaults['metadata']); |
57 | 57 | |
58 | - $urlNormalizer = function (Options $options, $value) { |
|
58 | + $urlNormalizer = function(Options $options, $value) { |
|
59 | 59 | if (empty($value)) { |
60 | 60 | return ''; |
61 | 61 | } |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | $metadataResolver->setNormalizer('license-url', $urlNormalizer); |
66 | 66 | $metadataResolver->setNormalizer('contact-url', $urlNormalizer); |
67 | 67 | }); |
68 | - $resolver->setNormalizer('resource-config', function (Options $options, $value) { |
|
69 | - return array_map(function ($field) { |
|
68 | + $resolver->setNormalizer('resource-config', function(Options $options, $value) { |
|
69 | + return array_map(function($field) { |
|
70 | 70 | return $field instanceof ApiResource ? $field : ApiResource::createFromArray($field); |
71 | 71 | }, $value); |
72 | 72 | }); |
73 | - $resolver->setNormalizer('contexts', function (Options $options, $value) use (&$defaults) { |
|
74 | - return array_map(function ($field) use ($defaults) { |
|
73 | + $resolver->setNormalizer('contexts', function(Options $options, $value) use (&$defaults) { |
|
74 | + return array_map(function($field) use ($defaults) { |
|
75 | 75 | return self::createResolver($defaults)->resolve($field); |
76 | 76 | }, $value); |
77 | 77 | }); |
78 | - $resolver->setNormalizer('exception-mapping', function (Options $options, $value) { |
|
78 | + $resolver->setNormalizer('exception-mapping', function(Options $options, $value) { |
|
79 | 79 | ApieConfigResolver::addExceptionsForExceptionMapping($value); |
80 | 80 | return $value; |
81 | 81 | }); |
@@ -38,21 +38,21 @@ |
||
38 | 38 | $resolver = new OptionsResolver(); |
39 | 39 | |
40 | 40 | $resolver->setDefaults($defaults) |
41 | - ->setAllowedTypes('resources', ['string[]', ApiResourcesInterface::class]) |
|
42 | - ->setAllowedTypes('plugins', ['string[]']) |
|
43 | - ->setAllowedTypes('resources-service', ['null', 'string']) |
|
44 | - ->setAllowedTypes('mock', ['null', 'bool']) |
|
45 | - ->setAllowedTypes('mock-skipped-resources', ['string[]']) |
|
46 | - ->setAllowedTypes('base-url', 'string') |
|
47 | - ->setAllowedTypes('api-url', 'string') |
|
48 | - ->setAllowedTypes('disable-routes', ['null', 'bool']) |
|
49 | - ->setAllowedTypes('swagger-ui-test-page', ['null', 'string']) |
|
50 | - ->setAllowedTypes('apie-middleware', 'string[]') |
|
51 | - ->setAllowedTypes('swagger-ui-test-page-middleware', 'string[]') |
|
52 | - ->setAllowedTypes('bind-api-resource-facade-response', 'bool') |
|
53 | - ->setAllowedTypes('metadata', 'string[]') |
|
54 | - ->setAllowedTypes('resource-config', [ApiResource::class . '[]', 'array[]']) |
|
55 | - ->setAllowedTypes('exception-mapping', 'int[]'); |
|
41 | + ->setAllowedTypes('resources', ['string[]', ApiResourcesInterface::class]) |
|
42 | + ->setAllowedTypes('plugins', ['string[]']) |
|
43 | + ->setAllowedTypes('resources-service', ['null', 'string']) |
|
44 | + ->setAllowedTypes('mock', ['null', 'bool']) |
|
45 | + ->setAllowedTypes('mock-skipped-resources', ['string[]']) |
|
46 | + ->setAllowedTypes('base-url', 'string') |
|
47 | + ->setAllowedTypes('api-url', 'string') |
|
48 | + ->setAllowedTypes('disable-routes', ['null', 'bool']) |
|
49 | + ->setAllowedTypes('swagger-ui-test-page', ['null', 'string']) |
|
50 | + ->setAllowedTypes('apie-middleware', 'string[]') |
|
51 | + ->setAllowedTypes('swagger-ui-test-page-middleware', 'string[]') |
|
52 | + ->setAllowedTypes('bind-api-resource-facade-response', 'bool') |
|
53 | + ->setAllowedTypes('metadata', 'string[]') |
|
54 | + ->setAllowedTypes('resource-config', [ApiResource::class . '[]', 'array[]']) |
|
55 | + ->setAllowedTypes('exception-mapping', 'int[]'); |
|
56 | 56 | $resolver->setDefault('metadata', function (OptionsResolver $metadataResolver) use (&$defaults) { |
57 | 57 | $metadataResolver->setDefaults($defaults['metadata']); |
58 | 58 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | // fix for PSR requests in Lumen |
27 | 27 | $this->app->extend( |
28 | - ServerRequestInterface::class, function (ServerRequestInterface $psrRequest) { |
|
28 | + ServerRequestInterface::class, function(ServerRequestInterface $psrRequest) { |
|
29 | 29 | $route = (array) $this->app->make('request')->route(); |
30 | 30 | if (is_array($route[2])) { |
31 | 31 | foreach ($route[2] as $key => $value) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | $this->app->bind( |
40 | 40 | SwaggerUiController::class, |
41 | - function () { |
|
41 | + function() { |
|
42 | 42 | $urlGenerator = new UrlGenerator($this->app); |
43 | 43 | return new SwaggerUiController( |
44 | 44 | $this->app->make(ApieContext::class), |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * apie.config: main config |
84 | 84 | */ |
85 | - $this->app->singleton('apie.config', function () { |
|
85 | + $this->app->singleton('apie.config', function() { |
|
86 | 86 | $config = $this->app->get('config'); |
87 | 87 | $res = ApieConfigResolver::resolveConfig($config->get('apie') ?? []); |
88 | 88 | $config->set('apie', $res); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | /** |
93 | 93 | * apie.plugins: array of Apie plugins of the main apie instance. |
94 | 94 | */ |
95 | - $this->app->singleton('apie.plugins', function () { |
|
95 | + $this->app->singleton('apie.plugins', function() { |
|
96 | 96 | $plugins = (array) $this->app->tagged(Apie::class); |
97 | 97 | $config = $this->app->get('apie.config'); |
98 | 98 | if (!empty($config['mock'])) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | /** |
119 | 119 | * ApieContext::class: get all Apie instances and see which is the current Apie instance. |
120 | 120 | */ |
121 | - $this->app->singleton(ApieContext::class, function () { |
|
121 | + $this->app->singleton(ApieContext::class, function() { |
|
122 | 122 | $plugins = $this->app->get('apie.plugins'); |
123 | 123 | $debug = (bool) config('app.debug'); |
124 | 124 | $config = $this->app->get('apie.config'); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | /** |
131 | 131 | * FileStorageDataLayerContainer::class: creates FileStorageDataLayer for the right Apie instance. |
132 | 132 | */ |
133 | - $this->app->singleton(FileStorageDataLayerContainer::class, function () { |
|
133 | + $this->app->singleton(FileStorageDataLayerContainer::class, function() { |
|
134 | 134 | return new FileStorageDataLayerContainer( |
135 | 135 | storage_path('app/api-file-storage'), |
136 | 136 | $this->app->get(ApieContext::class) |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | /** |
144 | 144 | * ApiResourcesInterface::class: get all resources of the current Apie instance. |
145 | 145 | */ |
146 | - $this->app->bind(ApiResourcesInterface::class, function () { |
|
146 | + $this->app->bind(ApiResourcesInterface::class, function() { |
|
147 | 147 | return new ApiResources($this->app->get(Apie::class)->getResources()); |
148 | 148 | }); |
149 | 149 | |
150 | 150 | /** |
151 | 151 | * Apie::class: current Apie instance. |
152 | 152 | */ |
153 | - $this->app->bind(Apie::class, function () { |
|
153 | + $this->app->bind(Apie::class, function() { |
|
154 | 154 | /** @var ApieContext $context */ |
155 | 155 | $context = $this->app->get(ApieContext::class)->getActiveContext(); |
156 | 156 | return $context->getApie(); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | /** |
160 | 160 | * IlluminatePlugin::class: current IlluminatePlugin instance |
161 | 161 | */ |
162 | - $this->app->bind(IlluminatePlugin::class, function () { |
|
162 | + $this->app->bind(IlluminatePlugin::class, function() { |
|
163 | 163 | /** @var Apie $apie */ |
164 | 164 | $apie = $this->app->get(Apie::class); |
165 | 165 | return $apie->getPlugin(IlluminatePlugin::class); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | /** |
169 | 169 | * ApplicationInfoRetriever::class: get retriever for Application Info of current apie instance. |
170 | 170 | */ |
171 | - $this->app->bind(ApplicationInfoRetriever::class, function () { |
|
171 | + $this->app->bind(ApplicationInfoRetriever::class, function() { |
|
172 | 172 | /** @var IlluminatePlugin $laravelPlugin */ |
173 | 173 | $laravelPlugin = $this->app->get(IlluminatePlugin::class); |
174 | 174 | $config = $laravelPlugin->getLaravelConfig(); |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | /** |
184 | 184 | * FileStorageDataLayer::class: get file storage data layer for current apie instance. |
185 | 185 | */ |
186 | - $this->app->bind(FileStorageDataLayer::class, function () { |
|
186 | + $this->app->bind(FileStorageDataLayer::class, function() { |
|
187 | 187 | return $this->app->get(FileStorageDataLayerContainer::class)->getCurrentFileStorageDataLayer(); |
188 | 188 | }); |
189 | 189 | |
190 | 190 | /** |
191 | 191 | * ApieExceptionToResponse::class: converts exception to an Apie response. |
192 | 192 | */ |
193 | - $this->app->bind(ApieExceptionToResponse::class, function () { |
|
193 | + $this->app->bind(ApieExceptionToResponse::class, function() { |
|
194 | 194 | /** @var IlluminatePlugin $laravelPlugin */ |
195 | 195 | $laravelPlugin = $this->app->get(IlluminatePlugin::class); |
196 | 196 | $config = $laravelPlugin->getLaravelConfig(); |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | /** |
202 | 202 | * Serializer::class: gets the Symfony serializer. |
203 | 203 | */ |
204 | - $this->app->bind(Serializer::class, function () { |
|
204 | + $this->app->bind(Serializer::class, function() { |
|
205 | 205 | $serializer = $this->app->get(ResourceSerializerInterface::class); |
206 | - if (! ($serializer instanceof SymfonySerializerAdapter)) { |
|
206 | + if (!($serializer instanceof SymfonySerializerAdapter)) { |
|
207 | 207 | throw new InvalidClassTypeException('resource serializer', SymfonySerializerAdapter::class); |
208 | 208 | } |
209 | 209 | return $serializer->getSerializer(); |
@@ -225,18 +225,18 @@ discard block |
||
225 | 225 | |
226 | 226 | private function registerApieService(string $serviceName, string $methodName) |
227 | 227 | { |
228 | - $this->app->bind($serviceName, function () use ($methodName) { |
|
228 | + $this->app->bind($serviceName, function() use ($methodName) { |
|
229 | 229 | return $this->app->get(Apie::class)->$methodName(); |
230 | 230 | }); |
231 | 231 | } |
232 | 232 | |
233 | 233 | private function addStatusResourceServices() |
234 | 234 | { |
235 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
235 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
236 | 236 | return new StatusFromDatabaseRetriever(config('app.debug')); |
237 | 237 | }); |
238 | 238 | $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']); |
239 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
239 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
240 | 240 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
241 | 241 | }); |
242 | 242 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | // fix for https://github.com/laravel/framework/issues/30415 |
38 | 38 | $this->app->extend( |
39 | 39 | ServerRequestInterface::class, |
40 | - function (ServerRequestInterface $psrRequest) { |
|
40 | + function(ServerRequestInterface $psrRequest) { |
|
41 | 41 | $route = $this->app->make('request')->route(); |
42 | 42 | if ($route) { |
43 | 43 | $parameters = $route->parameters(); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $this->app->bind( |
55 | 55 | SwaggerUiController::class, |
56 | - function () { |
|
56 | + function() { |
|
57 | 57 | $urlGenerator = $this->app->get(UrlGenerator::class); |
58 | 58 | return new SwaggerUiController( |
59 | 59 | $this->app->get(ApieContext::class), |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | ); |
65 | 65 | |
66 | - $this->app->bind(ApiResourceFacadeResponse::class, function () { |
|
66 | + $this->app->bind(ApiResourceFacadeResponse::class, function() { |
|
67 | 67 | /** @var ServerRequestInterface $request */ |
68 | 68 | $request = $this->app->get(ServerRequestInterface::class); |
69 | 69 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function registerResourceClass(string $resourceClass) |
82 | 82 | { |
83 | - $this->app->bind($resourceClass, function () use ($resourceClass) { |
|
83 | + $this->app->bind($resourceClass, function() use ($resourceClass) { |
|
84 | 84 | /** @var ServerRequestInterface $request */ |
85 | 85 | $request = $this->app->get(ServerRequestInterface::class); |
86 | 86 |