@@ -66,7 +66,7 @@ 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 | |
| 72 | 72 | $resolver = new OptionsResolver(); |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | return $resolver->resolve($config->get('apie') ?? []); |
| 76 | 76 | }); |
| 77 | 77 | |
| 78 | - $this->app->singleton(ApiResourcesInterface::class, function () { |
|
| 78 | + $this->app->singleton(ApiResourcesInterface::class, function() { |
|
| 79 | 79 | $config = $this->app->get('apie.config'); |
| 80 | - if (! empty($config['resources-service'])) { |
|
| 80 | + if (!empty($config['resources-service'])) { |
|
| 81 | 81 | return $this->app->get($config['resources-service']); |
| 82 | 82 | } |
| 83 | 83 | if ($config['resources'] instanceof ApiResourcesInterface) { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | return new ApiResources($config['resources']); |
| 87 | 87 | }); |
| 88 | 88 | |
| 89 | - $this->app->singleton(CacheItemPoolInterface::class, function () { |
|
| 89 | + $this->app->singleton(CacheItemPoolInterface::class, function() { |
|
| 90 | 90 | if ($this->app->bound('cache.psr6')) { |
| 91 | 91 | return $this->app->get('cache.psr6'); |
| 92 | 92 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | return new CacheItemPool($repository); |
| 95 | 95 | }); |
| 96 | 96 | |
| 97 | - $this->app->singleton(ServiceLibraryFactory::class, function () { |
|
| 97 | + $this->app->singleton(ServiceLibraryFactory::class, function() { |
|
| 98 | 98 | $config = $this->app->get('apie.config'); |
| 99 | 99 | $result = new ServiceLibraryFactory( |
| 100 | 100 | $this->app->get(ApiResourcesInterface::class), |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | storage_path('apie-cache') |
| 103 | 103 | ); |
| 104 | 104 | $result->setContainer($this->app); |
| 105 | - $result->runBeforeInstantiation(function () use (&$result) { |
|
| 105 | + $result->runBeforeInstantiation(function() use (&$result) { |
|
| 106 | 106 | $normalizers = [ |
| 107 | 107 | ]; |
| 108 | 108 | $taggedNormalizers = $this->app->tagged(NormalizerInterface::class); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | // OpenApiSpecGenerator: generated an OpenAPI 3.0 spec file from a list of resources. |
| 144 | 144 | $this->addOpenApiServices(); |
| 145 | - $this->app->singleton(OpenApiSpecGenerator::class, function () { |
|
| 145 | + $this->app->singleton(OpenApiSpecGenerator::class, function() { |
|
| 146 | 146 | $config = $this->app->get('apie.config'); |
| 147 | 147 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 148 | 148 | $baseUrl = $config['base-url'] . $config['api-url']; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | }); |
| 156 | 156 | |
| 157 | 157 | // SchemaGenerator: generates a OpenAPI Schema from a api resource class. |
| 158 | - $this->app->singleton(SchemaGenerator::class, function () { |
|
| 158 | + $this->app->singleton(SchemaGenerator::class, function() { |
|
| 159 | 159 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 160 | 160 | $service = $factory->getSchemaGenerator(); |
| 161 | 161 | $service->defineSchemaForResource(Uuid::class, new Schema(['type' => 'string', 'format' => 'uuid'])); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | return $service; |
| 164 | 164 | }); |
| 165 | 165 | |
| 166 | - $this->app->singleton(Serializer::class, function () { |
|
| 166 | + $this->app->singleton(Serializer::class, function() { |
|
| 167 | 167 | return $this->app->get(ServiceLibraryFactory::class)->getSerializer(); |
| 168 | 168 | }); |
| 169 | 169 | $this->app->bind(SerializerInterface::class, Serializer::class); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $this->app->singleton(CamelCaseToSnakeCaseNameConverter::class); |
| 173 | 173 | $this->app->bind(NameConverterInterface::class, CamelCaseToSnakeCaseNameConverter::class); |
| 174 | 174 | |
| 175 | - $this->app->singleton(ApplicationInfoRetriever::class, function () { |
|
| 175 | + $this->app->singleton(ApplicationInfoRetriever::class, function() { |
|
| 176 | 176 | $config = $this->app->get('apie.config'); |
| 177 | 177 | return new ApplicationInfoRetriever( |
| 178 | 178 | config('app.name'), |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | }); |
| 184 | 184 | $this->app->singleton(EloquentModelDataLayer::class); |
| 185 | 185 | $this->app->singleton(DatabaseQueryRetriever::class); |
| 186 | - $this->app->singleton(FileStorageDataLayer::class, function () { |
|
| 186 | + $this->app->singleton(FileStorageDataLayer::class, function() { |
|
| 187 | 187 | return new FileStorageDataLayer( |
| 188 | 188 | storage_path('api-file-storage'), |
| 189 | 189 | $this->app->get(ServiceLibraryFactory::class)->getPropertyAccessor() |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | }); |
| 192 | 192 | |
| 193 | 193 | // ApiResourceFacade: class that calls all the right services with a simple interface. |
| 194 | - $this->app->singleton(ApiResourceFacade::class, function () { |
|
| 194 | + $this->app->singleton(ApiResourceFacade::class, function() { |
|
| 195 | 195 | return $this->app->get(ServiceLibraryFactory::class)->getApiResourceFacade(); |
| 196 | 196 | }); |
| 197 | 197 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | private function addOpenApiServices() |
| 208 | 208 | { |
| 209 | 209 | // Provides contact information to the OpenAPI spec. |
| 210 | - $this->app->singleton(Contact::class, function () { |
|
| 210 | + $this->app->singleton(Contact::class, function() { |
|
| 211 | 211 | $config = $this->app->get('apie.config'); |
| 212 | 212 | return new Contact([ |
| 213 | 213 | 'name' => $config['metadata']['contact-name'], |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | }); |
| 218 | 218 | |
| 219 | 219 | // Provides license information to the OpenAPI spec. |
| 220 | - $this->app->singleton(License::class, function () { |
|
| 220 | + $this->app->singleton(License::class, function() { |
|
| 221 | 221 | $config = $this->app->get('apie.config'); |
| 222 | 222 | return new License( |
| 223 | 223 | $config['metadata']['license'], |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | }); |
| 227 | 227 | |
| 228 | 228 | // Provides OpenAPI info to the OpenAPI spec. |
| 229 | - $this->app->singleton(Info::class, function () { |
|
| 229 | + $this->app->singleton(Info::class, function() { |
|
| 230 | 230 | $config = $this->app->get('apie.config'); |
| 231 | 231 | return new Info( |
| 232 | 232 | $config['metadata']['title'], |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | private function addStatusResourceServices() |
| 244 | 244 | { |
| 245 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
| 245 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
| 246 | 246 | return new StatusFromDatabaseRetriever(config('app.debug')); |
| 247 | 247 | }); |
| 248 | 248 | $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']); |
| 249 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
| 249 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
| 250 | 250 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
| 251 | 251 | }); |
| 252 | 252 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function expiresAt($expires) |
| 81 | 81 | { |
| 82 | - if ($expires instanceof DateTimeInterface && ! $expires instanceof DateTimeImmutable) { |
|
| 82 | + if ($expires instanceof DateTimeInterface && !$expires instanceof DateTimeImmutable) { |
|
| 83 | 83 | $timezone = $expires->getTimezone(); |
| 84 | 84 | $expires = DateTimeImmutable::createFromFormat('U', (string) $expires->getTimestamp(), $timezone); |
| 85 | 85 | $expires->setTimezone($timezone); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $this->expires = new DateTimeImmutable(); |
| 105 | 105 | |
| 106 | - if (! $time instanceof DateInterval) { |
|
| 106 | + if (!$time instanceof DateInterval) { |
|
| 107 | 107 | $time = new DateInterval(sprintf('PT%sS', $time)); |
| 108 | 108 | } |
| 109 | 109 | |