@@ -34,15 +34,15 @@ |
||
| 34 | 34 | ->setAllowedTypes('swagger-ui-test-page-middleware', 'string[]') |
| 35 | 35 | ->setAllowedTypes('bind-api-resource-facade-response', 'bool') |
| 36 | 36 | ->setAllowedTypes('metadata', 'string[]'); |
| 37 | - $resolver->setDefault('metadata', function (OptionsResolver $metadataResolver) use (&$defaults) { |
|
| 37 | + $resolver->setDefault('metadata', function(OptionsResolver $metadataResolver) use (&$defaults) { |
|
| 38 | 38 | $metadataResolver->setDefaults($defaults['metadata']); |
| 39 | 39 | |
| 40 | - $urlNormalizer = function (Options $options, $value) { |
|
| 40 | + $urlNormalizer = function(Options $options, $value) { |
|
| 41 | 41 | if ($value === '') { |
| 42 | 42 | return ''; |
| 43 | 43 | } |
| 44 | 44 | if ('http://' !== substr($value, 0, 7) && 'https://' !== substr($value, 0, 8)) { |
| 45 | - $value = 'https://'.$value; |
|
| 45 | + $value = 'https://' . $value; |
|
| 46 | 46 | } |
| 47 | 47 | $parsedUrl = parse_url($value); |
| 48 | 48 | if (!$parsedUrl || !in_array($parsedUrl['scheme'], ['http', 'https']) || !filter_var($value, FILTER_VALIDATE_URL)) { |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function register() |
| 68 | 68 | { |
| 69 | - $this->app->singleton('apie.config', function () { |
|
| 69 | + $this->app->singleton('apie.config', function() { |
|
| 70 | 70 | $config = $this->app->get('config'); |
| 71 | 71 | return ApieConfigResolver::resolveConfig($config->get('apie') ?? []); |
| 72 | 72 | }); |
| 73 | 73 | |
| 74 | - $this->app->singleton(ApiResourcesInterface::class, function () { |
|
| 74 | + $this->app->singleton(ApiResourcesInterface::class, function() { |
|
| 75 | 75 | $config = $this->app->get('apie.config'); |
| 76 | - if (! empty($config['resources-service'])) { |
|
| 76 | + if (!empty($config['resources-service'])) { |
|
| 77 | 77 | return $this->app->get($config['resources-service']); |
| 78 | 78 | } |
| 79 | 79 | if ($config['resources'] instanceof ApiResourcesInterface) { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | return new ApiResources($config['resources']); |
| 83 | 83 | }); |
| 84 | 84 | |
| 85 | - $this->app->singleton(ServiceLibraryFactory::class, function () { |
|
| 85 | + $this->app->singleton(ServiceLibraryFactory::class, function() { |
|
| 86 | 86 | return $this->createServiceLibraryFactory(); |
| 87 | 87 | }); |
| 88 | 88 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | // OpenApiSpecGenerator: generated an OpenAPI 3.0 spec file from a list of resources. |
| 95 | 95 | $this->addOpenApiServices(); |
| 96 | - $this->app->singleton(OpenApiSpecGenerator::class, function () { |
|
| 96 | + $this->app->singleton(OpenApiSpecGenerator::class, function() { |
|
| 97 | 97 | $config = $this->app->get('apie.config'); |
| 98 | 98 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 99 | 99 | $baseUrl = $config['base-url'] . $config['api-url']; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | }); |
| 107 | 107 | |
| 108 | 108 | // SchemaGenerator: generates a OpenAPI Schema from a api resource class. |
| 109 | - $this->app->singleton(SchemaGenerator::class, function () { |
|
| 109 | + $this->app->singleton(SchemaGenerator::class, function() { |
|
| 110 | 110 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 111 | 111 | $service = $factory->getSchemaGenerator(); |
| 112 | 112 | $service->defineSchemaForResource(Uuid::class, new Schema(['type' => 'string', 'format' => 'uuid'])); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | return $service; |
| 115 | 115 | }); |
| 116 | 116 | |
| 117 | - $this->app->singleton(Serializer::class, function () { |
|
| 117 | + $this->app->singleton(Serializer::class, function() { |
|
| 118 | 118 | return $this->app->get(ServiceLibraryFactory::class)->getSerializer(); |
| 119 | 119 | }); |
| 120 | 120 | $this->app->bind(SerializerInterface::class, Serializer::class); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $this->app->singleton(CamelCaseToSnakeCaseNameConverter::class); |
| 124 | 124 | $this->app->bind(NameConverterInterface::class, CamelCaseToSnakeCaseNameConverter::class); |
| 125 | 125 | |
| 126 | - $this->app->singleton(ApplicationInfoRetriever::class, function () { |
|
| 126 | + $this->app->singleton(ApplicationInfoRetriever::class, function() { |
|
| 127 | 127 | $config = $this->app->get('apie.config'); |
| 128 | 128 | return new ApplicationInfoRetriever( |
| 129 | 129 | config('app.name'), |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | }); |
| 135 | 135 | $this->app->singleton(EloquentModelDataLayer::class); |
| 136 | 136 | $this->app->singleton(DatabaseQueryRetriever::class); |
| 137 | - $this->app->singleton(FileStorageDataLayer::class, function () { |
|
| 137 | + $this->app->singleton(FileStorageDataLayer::class, function() { |
|
| 138 | 138 | return new FileStorageDataLayer( |
| 139 | 139 | storage_path('app/api-file-storage'), |
| 140 | 140 | $this->app->get(ServiceLibraryFactory::class)->getPropertyAccessor() |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | }); |
| 143 | 143 | |
| 144 | 144 | // ApiResourceFacade: class that calls all the right services with a simple interface. |
| 145 | - $this->app->singleton(ApiResourceFacade::class, function () { |
|
| 145 | + $this->app->singleton(ApiResourceFacade::class, function() { |
|
| 146 | 146 | return $this->app->get(ServiceLibraryFactory::class)->getApiResourceFacade(); |
| 147 | 147 | }); |
| 148 | 148 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | private function addOpenApiServices() |
| 159 | 159 | { |
| 160 | 160 | // Provides contact information to the OpenAPI spec. |
| 161 | - $this->app->singleton(Contact::class, function () { |
|
| 161 | + $this->app->singleton(Contact::class, function() { |
|
| 162 | 162 | $config = $this->app->get('apie.config'); |
| 163 | 163 | return new Contact([ |
| 164 | 164 | 'name' => $config['metadata']['contact-name'], |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | }); |
| 169 | 169 | |
| 170 | 170 | // Provides license information to the OpenAPI spec. |
| 171 | - $this->app->singleton(License::class, function () { |
|
| 171 | + $this->app->singleton(License::class, function() { |
|
| 172 | 172 | $config = $this->app->get('apie.config'); |
| 173 | 173 | return new License( |
| 174 | 174 | $config['metadata']['license'], |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | }); |
| 178 | 178 | |
| 179 | 179 | // Provides OpenAPI info to the OpenAPI spec. |
| 180 | - $this->app->singleton(Info::class, function () { |
|
| 180 | + $this->app->singleton(Info::class, function() { |
|
| 181 | 181 | $config = $this->app->get('apie.config'); |
| 182 | 182 | return new Info( |
| 183 | 183 | $config['metadata']['title'], |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | if (!config('app.debug')) { |
| 204 | 204 | $this->handleSerializerCache($result); |
| 205 | 205 | } |
| 206 | - $result->runBeforeInstantiation(function () use (&$result) { |
|
| 206 | + $result->runBeforeInstantiation(function() use (&$result) { |
|
| 207 | 207 | $normalizers = [ |
| 208 | 208 | ]; |
| 209 | 209 | $taggedNormalizers = $this->app->tagged(NormalizerInterface::class); |
@@ -245,11 +245,11 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | private function addStatusResourceServices() |
| 247 | 247 | { |
| 248 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
| 248 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
| 249 | 249 | return new StatusFromDatabaseRetriever(config('app.debug')); |
| 250 | 250 | }); |
| 251 | 251 | $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']); |
| 252 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
| 252 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
| 253 | 253 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
| 254 | 254 | }); |
| 255 | 255 | } |