@@ -11,7 +11,7 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function up() |
| 13 | 13 | { |
| 14 | - Schema::create('statuses', function (Blueprint $table) { |
|
| 14 | + Schema::create('statuses', function(Blueprint $table) { |
|
| 15 | 15 | $table->string('id')->primary(); |
| 16 | 16 | $table->string('status'); |
| 17 | 17 | $table->string('optional_reference')->nullable(); |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | ), |
| 48 | 48 | ]); |
| 49 | 49 | } |
| 50 | - $list = array_map(function (Status $statusModel) { |
|
| 50 | + $list = array_map(function(Status $statusModel) { |
|
| 51 | 51 | return $this->convert($statusModel); |
| 52 | 52 | }, iterator_to_array($statuses)); |
| 53 | 53 | $list[] = new StaticStatusCheck(new ResourceStatus( |
@@ -76,10 +76,10 @@ |
||
| 76 | 76 | ->get(); |
| 77 | 77 | |
| 78 | 78 | return array_filter( |
| 79 | - array_map(function ($modelInstance) use (&$resourceClass) { |
|
| 79 | + array_map(function($modelInstance) use (&$resourceClass) { |
|
| 80 | 80 | return $this->denormalize($modelInstance->toArray(), $resourceClass); |
| 81 | 81 | }, iterator_to_array($modelInstances)), |
| 82 | - function ($resource) { |
|
| 82 | + function($resource) { |
|
| 83 | 83 | return $this->gate->allows('get', $resource); |
| 84 | 84 | } |
| 85 | 85 | ); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | public function __construct(string $resourceClass, string $options) { |
| 12 | 12 | parent::__construct( |
| 13 | 13 | 500, |
| 14 | - 'Resource ' . $resourceClass . ' misses ' . $options .' option in the ApiResource annotation' |
|
| 14 | + 'Resource ' . $resourceClass . ' misses ' . $options . ' option in the ApiResource annotation' |
|
| 15 | 15 | ); |
| 16 | 16 | } |
| 17 | 17 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | $apieConfig = app('apie.config'); |
| 12 | 12 | |
| 13 | -$router->group(['prefix' => $apieConfig['api-url'], 'middleware' => $apieConfig['apie-middleware']], function () use ($router) { |
|
| 13 | +$router->group(['prefix' => $apieConfig['api-url'], 'middleware' => $apieConfig['apie-middleware']], function() use ($router) { |
|
| 14 | 14 | $router->get('/doc.json', ['as' => 'apie.docs', 'uses' => DocsController::class]); |
| 15 | 15 | $router->post('/{resource}/', ['as' => 'apie.post', 'uses' => PostController::class]); |
| 16 | 16 | $router->put('/{resource}/{id}', ['as' => 'apie.put', 'uses' => PutController::class]); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | 'prefix' => $apieConfig['api-url'], |
| 14 | 14 | 'middleware' => $apieConfig['apie-middleware'] |
| 15 | 15 | ], |
| 16 | - function () { |
|
| 16 | + function() { |
|
| 17 | 17 | Route::get('/doc.json', DocsController::class)->name('apie.docs'); |
| 18 | 18 | Route::post('/{resource}/', PostController::class)->name('apie.post'); |
| 19 | 19 | Route::put('/{resource}/{id}', PutController::class)->name('apie.put'); |
@@ -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 ($route) { |
| 90 | 90 | $parameters = $route->parameters(); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | return $psrRequest; |
| 96 | 96 | }); |
| 97 | - $this->app->singleton('apie.config', function () { |
|
| 97 | + $this->app->singleton('apie.config', function() { |
|
| 98 | 98 | $config = $this->app->get('config'); |
| 99 | 99 | |
| 100 | 100 | $resolver = new OptionsResolver(); |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | return $resolver->resolve($config->get('apie') ?? []); |
| 104 | 104 | }); |
| 105 | 105 | |
| 106 | - $this->app->singleton(ApiResourcesInterface::class, function () { |
|
| 106 | + $this->app->singleton(ApiResourcesInterface::class, function() { |
|
| 107 | 107 | $config = $this->app->get('apie.config'); |
| 108 | - if (! empty($config['resources-service'])) { |
|
| 108 | + if (!empty($config['resources-service'])) { |
|
| 109 | 109 | return $this->app->get($config['resources-service']); |
| 110 | 110 | } |
| 111 | 111 | if ($config['resources'] instanceof ApiResourcesInterface) { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | return new ApiResources($config['resources']); |
| 115 | 115 | }); |
| 116 | 116 | |
| 117 | - $this->app->singleton(ServiceLibraryFactory::class, function () { |
|
| 117 | + $this->app->singleton(ServiceLibraryFactory::class, function() { |
|
| 118 | 118 | $config = $this->app->get('apie.config'); |
| 119 | 119 | $result = new ServiceLibraryFactory( |
| 120 | 120 | $this->app->get(ApiResourcesInterface::class), |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | storage_path('apie-cache') |
| 123 | 123 | ); |
| 124 | 124 | $result->setContainer($this->app); |
| 125 | - $result->runBeforeInstantiation(function () use (&$result) { |
|
| 125 | + $result->runBeforeInstantiation(function() use (&$result) { |
|
| 126 | 126 | $normalizers = [ |
| 127 | 127 | ]; |
| 128 | 128 | $taggedNormalizers = $this->app->tagged(NormalizerInterface::class); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | // OpenApiSpecGenerator: generated an OpenAPI 3.0 spec file from a list of resources. |
| 164 | 164 | $this->addOpenApiServices(); |
| 165 | - $this->app->singleton(OpenApiSpecGenerator::class, function () { |
|
| 165 | + $this->app->singleton(OpenApiSpecGenerator::class, function() { |
|
| 166 | 166 | $config = $this->app->get('apie.config'); |
| 167 | 167 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 168 | 168 | $baseUrl = $config['base-url'] . $config['api-url']; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | }); |
| 176 | 176 | |
| 177 | 177 | // SchemaGenerator: generates a OpenAPI Schema from a api resource class. |
| 178 | - $this->app->singleton(SchemaGenerator::class, function () { |
|
| 178 | + $this->app->singleton(SchemaGenerator::class, function() { |
|
| 179 | 179 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 180 | 180 | $service = $factory->getSchemaGenerator(); |
| 181 | 181 | $service->defineSchemaForResource(Uuid::class, new Schema(['type' => 'string', 'format' => 'uuid'])); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | return $service; |
| 184 | 184 | }); |
| 185 | 185 | |
| 186 | - $this->app->singleton(Serializer::class, function () { |
|
| 186 | + $this->app->singleton(Serializer::class, function() { |
|
| 187 | 187 | return $this->app->get(ServiceLibraryFactory::class)->getSerializer(); |
| 188 | 188 | }); |
| 189 | 189 | $this->app->bind(SerializerInterface::class, Serializer::class); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $this->app->singleton(CamelCaseToSnakeCaseNameConverter::class); |
| 193 | 193 | $this->app->bind(NameConverterInterface::class, CamelCaseToSnakeCaseNameConverter::class); |
| 194 | 194 | |
| 195 | - $this->app->singleton(AppRetriever::class, function () { |
|
| 195 | + $this->app->singleton(AppRetriever::class, function() { |
|
| 196 | 196 | $config = $this->app->get('apie.config'); |
| 197 | 197 | return new AppRetriever( |
| 198 | 198 | config('app.name'), |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | }); |
| 204 | 204 | $this->app->singleton(EloquentModelRetriever::class); |
| 205 | 205 | $this->app->singleton(DatabaseQueryRetriever::class); |
| 206 | - $this->app->singleton(FileStorageRetriever::class, function () { |
|
| 206 | + $this->app->singleton(FileStorageRetriever::class, function() { |
|
| 207 | 207 | return new FileStorageRetriever( |
| 208 | 208 | storage_path('api-file-storage'), |
| 209 | 209 | $this->app->get(ServiceLibraryFactory::class)->getPropertyAccessor() |
@@ -211,11 +211,11 @@ discard block |
||
| 211 | 211 | }); |
| 212 | 212 | |
| 213 | 213 | // ApiResourceFacade: class that calls all the right services with a simple interface. |
| 214 | - $this->app->singleton(ApiResourceFacade::class, function () { |
|
| 214 | + $this->app->singleton(ApiResourceFacade::class, function() { |
|
| 215 | 215 | return $this->app->get(ServiceLibraryFactory::class)->getApiResourceFacade(); |
| 216 | 216 | }); |
| 217 | 217 | |
| 218 | - $this->app->bind(SwaggerUiController::class, function () { |
|
| 218 | + $this->app->bind(SwaggerUiController::class, function() { |
|
| 219 | 219 | if ($this->app->has(UrlGenerator::class)) { |
| 220 | 220 | $urlGenerator = $this->app->get(UrlGenerator::class); |
| 221 | 221 | } else { |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | private function addOpenApiServices() |
| 231 | 231 | { |
| 232 | 232 | // Provides contact information to the OpenAPI spec. |
| 233 | - $this->app->singleton(Contact::class, function () { |
|
| 233 | + $this->app->singleton(Contact::class, function() { |
|
| 234 | 234 | $config = $this->app->get('apie.config'); |
| 235 | 235 | return new Contact([ |
| 236 | 236 | 'name' => $config['metadata']['contact-name'], |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | }); |
| 241 | 241 | |
| 242 | 242 | // Provides license information to the OpenAPI spec. |
| 243 | - $this->app->singleton(License::class, function () { |
|
| 243 | + $this->app->singleton(License::class, function() { |
|
| 244 | 244 | $config = $this->app->get('apie.config'); |
| 245 | 245 | return new License( |
| 246 | 246 | $config['metadata']['license'], |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | }); |
| 250 | 250 | |
| 251 | 251 | // Provides OpenAPI info to the OpenAPI spec. |
| 252 | - $this->app->singleton(Info::class, function () { |
|
| 252 | + $this->app->singleton(Info::class, function() { |
|
| 253 | 253 | $config = $this->app->get('apie.config'); |
| 254 | 254 | return new Info( |
| 255 | 255 | $config['metadata']['title'], |
@@ -265,11 +265,11 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | private function addStatusResourceServices() |
| 267 | 267 | { |
| 268 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
| 268 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
| 269 | 269 | return new StatusFromDatabaseRetriever(config('app.debug')); |
| 270 | 270 | }); |
| 271 | 271 | $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']); |
| 272 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
| 272 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
| 273 | 273 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
| 274 | 274 | }); |
| 275 | 275 | } |