@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function register() |
| 85 | 85 | { |
| 86 | 86 | // fix for https://github.com/laravel/framework/issues/30415 |
| 87 | - $this->app->extend(ServerRequestInterface::class, function (ServerRequestInterface $psrRequest) { |
|
| 87 | + $this->app->extend(ServerRequestInterface::class, function(ServerRequestInterface $psrRequest) { |
|
| 88 | 88 | $route = $this->app->make('request')->route(); |
| 89 | 89 | if (is_array($route) && is_array($route[2])) { |
| 90 | 90 | foreach ($route[2] as $key => $value) { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | return $psrRequest; |
| 100 | 100 | }); |
| 101 | - $this->app->singleton('apie.config', function () { |
|
| 101 | + $this->app->singleton('apie.config', function() { |
|
| 102 | 102 | $config = $this->app->get('config'); |
| 103 | 103 | |
| 104 | 104 | $resolver = new OptionsResolver(); |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | return $resolver->resolve($config->get('apie') ?? []); |
| 108 | 108 | }); |
| 109 | 109 | |
| 110 | - $this->app->singleton(ApiResourcesInterface::class, function () { |
|
| 110 | + $this->app->singleton(ApiResourcesInterface::class, function() { |
|
| 111 | 111 | $config = $this->app->get('apie.config'); |
| 112 | - if (! empty($config['resources-service'])) { |
|
| 112 | + if (!empty($config['resources-service'])) { |
|
| 113 | 113 | return $this->app->get($config['resources-service']); |
| 114 | 114 | } |
| 115 | 115 | if ($config['resources'] instanceof ApiResourcesInterface) { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | return new ApiResources($config['resources']); |
| 119 | 119 | }); |
| 120 | 120 | |
| 121 | - $this->app->singleton(ServiceLibraryFactory::class, function () { |
|
| 121 | + $this->app->singleton(ServiceLibraryFactory::class, function() { |
|
| 122 | 122 | $config = $this->app->get('apie.config'); |
| 123 | 123 | $result = new ServiceLibraryFactory( |
| 124 | 124 | $this->app->get(ApiResourcesInterface::class), |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | storage_path('apie-cache') |
| 127 | 127 | ); |
| 128 | 128 | $result->setContainer($this->app); |
| 129 | - $result->runBeforeInstantiation(function () use (&$result) { |
|
| 129 | + $result->runBeforeInstantiation(function() use (&$result) { |
|
| 130 | 130 | $normalizers = [ |
| 131 | 131 | ]; |
| 132 | 132 | $taggedNormalizers = $this->app->tagged(NormalizerInterface::class); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | // OpenApiSpecGenerator: generated an OpenAPI 3.0 spec file from a list of resources. |
| 168 | 168 | $this->addOpenApiServices(); |
| 169 | - $this->app->singleton(OpenApiSpecGenerator::class, function () { |
|
| 169 | + $this->app->singleton(OpenApiSpecGenerator::class, function() { |
|
| 170 | 170 | $config = $this->app->get('apie.config'); |
| 171 | 171 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 172 | 172 | $baseUrl = $config['base-url'] . $config['api-url']; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | }); |
| 180 | 180 | |
| 181 | 181 | // SchemaGenerator: generates a OpenAPI Schema from a api resource class. |
| 182 | - $this->app->singleton(SchemaGenerator::class, function () { |
|
| 182 | + $this->app->singleton(SchemaGenerator::class, function() { |
|
| 183 | 183 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 184 | 184 | $service = $factory->getSchemaGenerator(); |
| 185 | 185 | $service->defineSchemaForResource(Uuid::class, new Schema(['type' => 'string', 'format' => 'uuid'])); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | return $service; |
| 188 | 188 | }); |
| 189 | 189 | |
| 190 | - $this->app->singleton(Serializer::class, function () { |
|
| 190 | + $this->app->singleton(Serializer::class, function() { |
|
| 191 | 191 | return $this->app->get(ServiceLibraryFactory::class)->getSerializer(); |
| 192 | 192 | }); |
| 193 | 193 | $this->app->bind(SerializerInterface::class, Serializer::class); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $this->app->singleton(CamelCaseToSnakeCaseNameConverter::class); |
| 197 | 197 | $this->app->bind(NameConverterInterface::class, CamelCaseToSnakeCaseNameConverter::class); |
| 198 | 198 | |
| 199 | - $this->app->singleton(AppRetriever::class, function () { |
|
| 199 | + $this->app->singleton(AppRetriever::class, function() { |
|
| 200 | 200 | $config = $this->app->get('apie.config'); |
| 201 | 201 | return new AppRetriever( |
| 202 | 202 | config('app.name'), |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | }); |
| 208 | 208 | $this->app->singleton(EloquentModelRetriever::class); |
| 209 | 209 | $this->app->singleton(DatabaseQueryRetriever::class); |
| 210 | - $this->app->singleton(FileStorageRetriever::class, function () { |
|
| 210 | + $this->app->singleton(FileStorageRetriever::class, function() { |
|
| 211 | 211 | return new FileStorageRetriever( |
| 212 | 212 | storage_path('api-file-storage'), |
| 213 | 213 | $this->app->get(ServiceLibraryFactory::class)->getPropertyAccessor() |
@@ -215,11 +215,11 @@ discard block |
||
| 215 | 215 | }); |
| 216 | 216 | |
| 217 | 217 | // ApiResourceFacade: class that calls all the right services with a simple interface. |
| 218 | - $this->app->singleton(ApiResourceFacade::class, function () { |
|
| 218 | + $this->app->singleton(ApiResourceFacade::class, function() { |
|
| 219 | 219 | return $this->app->get(ServiceLibraryFactory::class)->getApiResourceFacade(); |
| 220 | 220 | }); |
| 221 | 221 | |
| 222 | - $this->app->bind(SwaggerUiController::class, function () { |
|
| 222 | + $this->app->bind(SwaggerUiController::class, function() { |
|
| 223 | 223 | if ($this->app->has(UrlGenerator::class)) { |
| 224 | 224 | $urlGenerator = $this->app->get(UrlGenerator::class); |
| 225 | 225 | } else { |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | private function addOpenApiServices() |
| 235 | 235 | { |
| 236 | 236 | // Provides contact information to the OpenAPI spec. |
| 237 | - $this->app->singleton(Contact::class, function () { |
|
| 237 | + $this->app->singleton(Contact::class, function() { |
|
| 238 | 238 | $config = $this->app->get('apie.config'); |
| 239 | 239 | return new Contact([ |
| 240 | 240 | 'name' => $config['metadata']['contact-name'], |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | }); |
| 245 | 245 | |
| 246 | 246 | // Provides license information to the OpenAPI spec. |
| 247 | - $this->app->singleton(License::class, function () { |
|
| 247 | + $this->app->singleton(License::class, function() { |
|
| 248 | 248 | $config = $this->app->get('apie.config'); |
| 249 | 249 | return new License( |
| 250 | 250 | $config['metadata']['license'], |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | }); |
| 254 | 254 | |
| 255 | 255 | // Provides OpenAPI info to the OpenAPI spec. |
| 256 | - $this->app->singleton(Info::class, function () { |
|
| 256 | + $this->app->singleton(Info::class, function() { |
|
| 257 | 257 | $config = $this->app->get('apie.config'); |
| 258 | 258 | return new Info( |
| 259 | 259 | $config['metadata']['title'], |
@@ -269,11 +269,11 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | private function addStatusResourceServices() |
| 271 | 271 | { |
| 272 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
| 272 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
| 273 | 273 | return new StatusFromDatabaseRetriever(config('app.debug')); |
| 274 | 274 | }); |
| 275 | 275 | $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']); |
| 276 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
| 276 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
| 277 | 277 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
| 278 | 278 | }); |
| 279 | 279 | } |