@@ -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), |
@@ -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 | |
@@ -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,14 +92,14 @@ 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 | return $this->getPlugins(); |
| 97 | 97 | }); |
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * ApieContext::class: get all Apie instances and see which is the current Apie instance. |
| 101 | 101 | */ |
| 102 | - $this->app->singleton(ApieContext::class, function () { |
|
| 102 | + $this->app->singleton(ApieContext::class, function() { |
|
| 103 | 103 | $plugins = $this->app->get('apie.plugins'); |
| 104 | 104 | $debug = (bool) config('app.debug'); |
| 105 | 105 | $config = $this->app->get('apie.config'); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | /** |
| 112 | 112 | * FileStorageDataLayerContainer::class: creates FileStorageDataLayer for the right Apie instance. |
| 113 | 113 | */ |
| 114 | - $this->app->singleton(FileStorageDataLayerContainer::class, function () { |
|
| 114 | + $this->app->singleton(FileStorageDataLayerContainer::class, function() { |
|
| 115 | 115 | return new FileStorageDataLayerContainer( |
| 116 | 116 | storage_path('app/api-file-storage'), |
| 117 | 117 | $this->app->get(ApieContext::class) |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | /** |
| 152 | 152 | * ApiResourcesInterface::class: get all resources of the current Apie instance. |
| 153 | 153 | */ |
| 154 | - $this->app->bind(ApiResourcesInterface::class, function () { |
|
| 154 | + $this->app->bind(ApiResourcesInterface::class, function() { |
|
| 155 | 155 | return new ApiResources($this->app->get(Apie::class)->getResources()); |
| 156 | 156 | }); |
| 157 | 157 | |
| 158 | 158 | /** |
| 159 | 159 | * Apie::class: current Apie instance. |
| 160 | 160 | */ |
| 161 | - $this->app->bind(Apie::class, function () { |
|
| 161 | + $this->app->bind(Apie::class, function() { |
|
| 162 | 162 | /** @var ApieContext $context */ |
| 163 | 163 | $context = $this->app->get(ApieContext::class)->getActiveContext(); |
| 164 | 164 | return $context->getApie(); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | /** |
| 168 | 168 | * IlluminatePlugin::class: current IlluminatePlugin instance |
| 169 | 169 | */ |
| 170 | - $this->app->bind(IlluminatePlugin::class, function () { |
|
| 170 | + $this->app->bind(IlluminatePlugin::class, function() { |
|
| 171 | 171 | /** @var Apie $apie */ |
| 172 | 172 | $apie = $this->app->get(Apie::class); |
| 173 | 173 | return $apie->getPlugin(IlluminatePlugin::class); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | /** |
| 177 | 177 | * ApplicationInfoRetriever::class: get retriever for Application Info of current apie instance. |
| 178 | 178 | */ |
| 179 | - $this->app->bind(ApplicationInfoRetriever::class, function () { |
|
| 179 | + $this->app->bind(ApplicationInfoRetriever::class, function() { |
|
| 180 | 180 | /** @var IlluminatePlugin $laravelPlugin */ |
| 181 | 181 | $laravelPlugin = $this->app->get(IlluminatePlugin::class); |
| 182 | 182 | $config = $laravelPlugin->getLaravelConfig(); |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | /** |
| 192 | 192 | * FileStorageDataLayer::class: get file storage data layer for current apie instance. |
| 193 | 193 | */ |
| 194 | - $this->app->bind(FileStorageDataLayer::class, function () { |
|
| 194 | + $this->app->bind(FileStorageDataLayer::class, function() { |
|
| 195 | 195 | return $this->app->get(FileStorageDataLayerContainer::class)->getCurrentFileStorageDataLayer(); |
| 196 | 196 | }); |
| 197 | 197 | |
| 198 | 198 | /** |
| 199 | 199 | * ApieExceptionToResponse::class: converts exception to an Apie response. |
| 200 | 200 | */ |
| 201 | - $this->app->bind(ApieExceptionToResponse::class, function () { |
|
| 201 | + $this->app->bind(ApieExceptionToResponse::class, function() { |
|
| 202 | 202 | /** @var IlluminatePlugin $laravelPlugin */ |
| 203 | 203 | $laravelPlugin = $this->app->get(IlluminatePlugin::class); |
| 204 | 204 | $config = $laravelPlugin->getLaravelConfig(); |
@@ -209,9 +209,9 @@ discard block |
||
| 209 | 209 | /** |
| 210 | 210 | * Serializer::class: gets the Symfony serializer. |
| 211 | 211 | */ |
| 212 | - $this->app->bind(Serializer::class, function () { |
|
| 212 | + $this->app->bind(Serializer::class, function() { |
|
| 213 | 213 | $serializer = $this->app->get(ResourceSerializerInterface::class); |
| 214 | - if (! ($serializer instanceof SymfonySerializerAdapter)) { |
|
| 214 | + if (!($serializer instanceof SymfonySerializerAdapter)) { |
|
| 215 | 215 | throw new InvalidClassTypeException('resource serializer', SymfonySerializerAdapter::class); |
| 216 | 216 | } |
| 217 | 217 | return $serializer->getSerializer(); |
@@ -233,18 +233,18 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | private function registerApieService(string $serviceName, string $methodName) |
| 235 | 235 | { |
| 236 | - $this->app->bind($serviceName, function () use ($methodName) { |
|
| 236 | + $this->app->bind($serviceName, function() use ($methodName) { |
|
| 237 | 237 | return $this->app->get(Apie::class)->$methodName(); |
| 238 | 238 | }); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | private function addStatusResourceServices() |
| 242 | 242 | { |
| 243 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
| 243 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
| 244 | 244 | return new StatusFromDatabaseRetriever(config('app.debug')); |
| 245 | 245 | }); |
| 246 | 246 | $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']); |
| 247 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
| 247 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
| 248 | 248 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
| 249 | 249 | }); |
| 250 | 250 | } |