@@ -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 | /** |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | ->setAllowedTypes('metadata', 'string[]') |
47 | 47 | ->setAllowedTypes('resource-config', [ApiResource::class . '[]', 'array[]']) |
48 | 48 | ->setAllowedTypes('exception-mapping', 'int[]'); |
49 | - $resolver->setDefault('metadata', function (OptionsResolver $metadataResolver) use (&$defaults) { |
|
49 | + $resolver->setDefault('metadata', function(OptionsResolver $metadataResolver) use (&$defaults) { |
|
50 | 50 | $metadataResolver->setDefaults($defaults['metadata']); |
51 | 51 | |
52 | - $urlNormalizer = function (Options $options, $value) { |
|
52 | + $urlNormalizer = function(Options $options, $value) { |
|
53 | 53 | if (empty($value)) { |
54 | 54 | return ''; |
55 | 55 | } |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | $metadataResolver->setNormalizer('license-url', $urlNormalizer); |
60 | 60 | $metadataResolver->setNormalizer('contact-url', $urlNormalizer); |
61 | 61 | }); |
62 | - $resolver->setNormalizer('resource-config', function (Options $options, $value) { |
|
63 | - return array_map(function ($field) { |
|
62 | + $resolver->setNormalizer('resource-config', function(Options $options, $value) { |
|
63 | + return array_map(function($field) { |
|
64 | 64 | return $field instanceof ApiResource ? $field : ApiResource::createFromArray($field); |
65 | 65 | }, $value); |
66 | 66 | }); |
67 | - $resolver->setNormalizer('contexts', function (Options $options, $value) { |
|
68 | - return array_map(function ($field) use ($options) { |
|
67 | + $resolver->setNormalizer('contexts', function(Options $options, $value) { |
|
68 | + return array_map(function($field) use ($options) { |
|
69 | 69 | return self::getResolver((array) $options)->resolve($field); |
70 | 70 | }, $value); |
71 | 71 | }); |
72 | - $resolver->setNormalizer('exception-mapping', function (Options $options, $value) { |
|
72 | + $resolver->setNormalizer('exception-mapping', function(Options $options, $value) { |
|
73 | 73 | ApieConfigResolver::addExceptionsForExceptionMapping($value); |
74 | 74 | return $value; |
75 | 75 | }); |
@@ -60,18 +60,18 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function register() |
62 | 62 | { |
63 | - $this->app->singleton('apie.config', function () { |
|
63 | + $this->app->singleton('apie.config', function() { |
|
64 | 64 | $config = $this->app->get('config'); |
65 | 65 | $res = ApieConfigResolver::resolveConfig($config->get('apie') ?? []); |
66 | 66 | $config->set('apie', $res); |
67 | 67 | return $res; |
68 | 68 | }); |
69 | 69 | |
70 | - $this->app->singleton(ApiResourcesInterface::class, function () { |
|
70 | + $this->app->singleton(ApiResourcesInterface::class, function() { |
|
71 | 71 | return new ApiResources($this->app->get(Apie::class)->getResources()); |
72 | 72 | }); |
73 | 73 | |
74 | - $this->app->singleton(ApieContext::class, function () { |
|
74 | + $this->app->singleton(ApieContext::class, function() { |
|
75 | 75 | $plugins = $this->app->get('apie.plugins'); |
76 | 76 | $debug = (bool) config('app.debug'); |
77 | 77 | $config = $this->app->get('apie.config'); |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | return new ApieContext($this->app, $apie, $config, $config['contexts']); |
81 | 81 | }); |
82 | 82 | |
83 | - $this->app->bind(Apie::class, function () { |
|
83 | + $this->app->bind(Apie::class, function() { |
|
84 | 84 | /** @var ApieContext $context */ |
85 | 85 | $context = $this->app->get(ApieContext::class)->getActiveContext(); |
86 | 86 | return $context->getApie(); |
87 | 87 | }); |
88 | 88 | |
89 | - $this->app->singleton('apie.plugins', function () { |
|
89 | + $this->app->singleton('apie.plugins', function() { |
|
90 | 90 | $plugins = (array) $this->app->tagged(Apie::class); |
91 | 91 | $config = $this->app->get('apie.config'); |
92 | 92 | if (!empty($config['mock'])) { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $this->bindApieServices(); |
114 | 114 | |
115 | - $this->app->singleton(ApplicationInfoRetriever::class, function () { |
|
115 | + $this->app->singleton(ApplicationInfoRetriever::class, function() { |
|
116 | 116 | $config = $this->app->get('apie.config'); |
117 | 117 | return new ApplicationInfoRetriever( |
118 | 118 | config('app.name'), |
@@ -121,21 +121,21 @@ discard block |
||
121 | 121 | config('app.debug') |
122 | 122 | ); |
123 | 123 | }); |
124 | - $this->app->singleton(FileStorageDataLayer::class, function () { |
|
124 | + $this->app->singleton(FileStorageDataLayer::class, function() { |
|
125 | 125 | return new FileStorageDataLayer( |
126 | 126 | storage_path('app/api-file-storage'), |
127 | 127 | $this->app->get(Apie::class)->getPropertyAccessor() |
128 | 128 | ); |
129 | 129 | }); |
130 | 130 | |
131 | - $this->app->singleton(ApieExceptionToResponse::class, function () { |
|
131 | + $this->app->singleton(ApieExceptionToResponse::class, function() { |
|
132 | 132 | $mapping = $this->app->get('apie.config')['exception-mapping']; |
133 | 133 | return new ApieExceptionToResponse(resolve(HttpFoundationFactory::class), $mapping); |
134 | 134 | }); |
135 | 135 | |
136 | - $this->app->singleton(Serializer::class, function () { |
|
136 | + $this->app->singleton(Serializer::class, function() { |
|
137 | 137 | $serializer = $this->app->get(ResourceSerializerInterface::class); |
138 | - if (! ($serializer instanceof SymfonySerializerAdapter)) { |
|
138 | + if (!($serializer instanceof SymfonySerializerAdapter)) { |
|
139 | 139 | throw new InvalidClassTypeException('resource serializer', SymfonySerializerAdapter::class); |
140 | 140 | } |
141 | 141 | return $serializer->getSerializer(); |
@@ -161,18 +161,18 @@ discard block |
||
161 | 161 | |
162 | 162 | private function registerApieService(string $serviceName, string $methodName) |
163 | 163 | { |
164 | - $this->app->bind($serviceName, function () use ($methodName) { |
|
164 | + $this->app->bind($serviceName, function() use ($methodName) { |
|
165 | 165 | return $this->app->get(Apie::class)->$methodName(); |
166 | 166 | }); |
167 | 167 | } |
168 | 168 | |
169 | 169 | private function addStatusResourceServices() |
170 | 170 | { |
171 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
171 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
172 | 172 | return new StatusFromDatabaseRetriever(config('app.debug')); |
173 | 173 | }); |
174 | 174 | $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']); |
175 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
175 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
176 | 176 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
177 | 177 | }); |
178 | 178 | } |
@@ -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 | ); |