@@ -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(); |
@@ -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'); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | // fix for PSR requests in Lumen |
| 28 | 28 | $this->app->extend( |
| 29 | - ServerRequestInterface::class, function (ServerRequestInterface $psrRequest) { |
|
| 29 | + ServerRequestInterface::class, function(ServerRequestInterface $psrRequest) { |
|
| 30 | 30 | $route = (array) $this->app->make('request')->route(); |
| 31 | 31 | if (is_array($route[2])) { |
| 32 | 32 | foreach ($route[2] as $key => $value) { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | 40 | $this->app->bind( |
| 41 | - SwaggerUiController::class, function () { |
|
| 41 | + SwaggerUiController::class, function() { |
|
| 42 | 42 | $urlGenerator = new \Laravel\Lumen\Routing\UrlGenerator($this->app); |
| 43 | 43 | return new SwaggerUiController($urlGenerator, __DIR__ . '/../../resources/open-api.html'); |
| 44 | 44 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function register() |
| 67 | 67 | { |
| 68 | - $this->app->singleton('apie.config', function () { |
|
| 68 | + $this->app->singleton('apie.config', function() { |
|
| 69 | 69 | $config = $this->app->get('config'); |
| 70 | 70 | |
| 71 | 71 | $resolver = new OptionsResolver(); |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | return $resolver->resolve($config->get('apie') ?? []); |
| 75 | 75 | }); |
| 76 | 76 | |
| 77 | - $this->app->singleton(ApiResourcesInterface::class, function () { |
|
| 77 | + $this->app->singleton(ApiResourcesInterface::class, function() { |
|
| 78 | 78 | $config = $this->app->get('apie.config'); |
| 79 | - if (! empty($config['resources-service'])) { |
|
| 79 | + if (!empty($config['resources-service'])) { |
|
| 80 | 80 | return $this->app->get($config['resources-service']); |
| 81 | 81 | } |
| 82 | 82 | if ($config['resources'] instanceof ApiResourcesInterface) { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | return new ApiResources($config['resources']); |
| 86 | 86 | }); |
| 87 | 87 | |
| 88 | - $this->app->singleton(ServiceLibraryFactory::class, function () { |
|
| 88 | + $this->app->singleton(ServiceLibraryFactory::class, function() { |
|
| 89 | 89 | $config = $this->app->get('apie.config'); |
| 90 | 90 | $result = new ServiceLibraryFactory( |
| 91 | 91 | $this->app->get(ApiResourcesInterface::class), |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | storage_path('apie-cache') |
| 94 | 94 | ); |
| 95 | 95 | $result->setContainer($this->app); |
| 96 | - $result->runBeforeInstantiation(function () use (&$result) { |
|
| 96 | + $result->runBeforeInstantiation(function() use (&$result) { |
|
| 97 | 97 | $normalizers = [ |
| 98 | 98 | ]; |
| 99 | 99 | $taggedNormalizers = $this->app->tagged(NormalizerInterface::class); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | // OpenApiSpecGenerator: generated an OpenAPI 3.0 spec file from a list of resources. |
| 135 | 135 | $this->addOpenApiServices(); |
| 136 | - $this->app->singleton(OpenApiSpecGenerator::class, function () { |
|
| 136 | + $this->app->singleton(OpenApiSpecGenerator::class, function() { |
|
| 137 | 137 | $config = $this->app->get('apie.config'); |
| 138 | 138 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 139 | 139 | $baseUrl = $config['base-url'] . $config['api-url']; |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | }); |
| 147 | 147 | |
| 148 | 148 | // SchemaGenerator: generates a OpenAPI Schema from a api resource class. |
| 149 | - $this->app->singleton(SchemaGenerator::class, function () { |
|
| 149 | + $this->app->singleton(SchemaGenerator::class, function() { |
|
| 150 | 150 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 151 | 151 | $service = $factory->getSchemaGenerator(); |
| 152 | 152 | $service->defineSchemaForResource(Uuid::class, new Schema(['type' => 'string', 'format' => 'uuid'])); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | return $service; |
| 155 | 155 | }); |
| 156 | 156 | |
| 157 | - $this->app->singleton(Serializer::class, function () { |
|
| 157 | + $this->app->singleton(Serializer::class, function() { |
|
| 158 | 158 | return $this->app->get(ServiceLibraryFactory::class)->getSerializer(); |
| 159 | 159 | }); |
| 160 | 160 | $this->app->bind(SerializerInterface::class, Serializer::class); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $this->app->singleton(CamelCaseToSnakeCaseNameConverter::class); |
| 164 | 164 | $this->app->bind(NameConverterInterface::class, CamelCaseToSnakeCaseNameConverter::class); |
| 165 | 165 | |
| 166 | - $this->app->singleton(AppRetriever::class, function () { |
|
| 166 | + $this->app->singleton(AppRetriever::class, function() { |
|
| 167 | 167 | $config = $this->app->get('apie.config'); |
| 168 | 168 | return new AppRetriever( |
| 169 | 169 | config('app.name'), |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | }); |
| 175 | 175 | $this->app->singleton(EloquentModelRetriever::class); |
| 176 | 176 | $this->app->singleton(DatabaseQueryRetriever::class); |
| 177 | - $this->app->singleton(FileStorageRetriever::class, function () { |
|
| 177 | + $this->app->singleton(FileStorageRetriever::class, function() { |
|
| 178 | 178 | return new FileStorageRetriever( |
| 179 | 179 | storage_path('api-file-storage'), |
| 180 | 180 | $this->app->get(ServiceLibraryFactory::class)->getPropertyAccessor() |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | }); |
| 183 | 183 | |
| 184 | 184 | // ApiResourceFacade: class that calls all the right services with a simple interface. |
| 185 | - $this->app->singleton(ApiResourceFacade::class, function () { |
|
| 185 | + $this->app->singleton(ApiResourceFacade::class, function() { |
|
| 186 | 186 | return $this->app->get(ServiceLibraryFactory::class)->getApiResourceFacade(); |
| 187 | 187 | }); |
| 188 | 188 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | private function addOpenApiServices() |
| 199 | 199 | { |
| 200 | 200 | // Provides contact information to the OpenAPI spec. |
| 201 | - $this->app->singleton(Contact::class, function () { |
|
| 201 | + $this->app->singleton(Contact::class, function() { |
|
| 202 | 202 | $config = $this->app->get('apie.config'); |
| 203 | 203 | return new Contact([ |
| 204 | 204 | 'name' => $config['metadata']['contact-name'], |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | }); |
| 209 | 209 | |
| 210 | 210 | // Provides license information to the OpenAPI spec. |
| 211 | - $this->app->singleton(License::class, function () { |
|
| 211 | + $this->app->singleton(License::class, function() { |
|
| 212 | 212 | $config = $this->app->get('apie.config'); |
| 213 | 213 | return new License( |
| 214 | 214 | $config['metadata']['license'], |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | }); |
| 218 | 218 | |
| 219 | 219 | // Provides OpenAPI info to the OpenAPI spec. |
| 220 | - $this->app->singleton(Info::class, function () { |
|
| 220 | + $this->app->singleton(Info::class, function() { |
|
| 221 | 221 | $config = $this->app->get('apie.config'); |
| 222 | 222 | return new Info( |
| 223 | 223 | $config['metadata']['title'], |
@@ -233,11 +233,11 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | private function addStatusResourceServices() |
| 235 | 235 | { |
| 236 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
| 236 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
| 237 | 237 | return new StatusFromDatabaseRetriever(config('app.debug')); |
| 238 | 238 | }); |
| 239 | 239 | $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']); |
| 240 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
| 240 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
| 241 | 241 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
| 242 | 242 | }); |
| 243 | 243 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | // fix for https://github.com/laravel/framework/issues/30415 |
| 29 | 29 | $this->app->extend( |
| 30 | - ServerRequestInterface::class, function (ServerRequestInterface $psrRequest) { |
|
| 30 | + ServerRequestInterface::class, function(ServerRequestInterface $psrRequest) { |
|
| 31 | 31 | $route = $this->app->make('request')->route(); |
| 32 | 32 | if ($route) { |
| 33 | 33 | $parameters = $route->parameters(); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | ); |
| 41 | 41 | |
| 42 | 42 | $this->app->bind( |
| 43 | - SwaggerUiController::class, function () { |
|
| 43 | + SwaggerUiController::class, function() { |
|
| 44 | 44 | $urlGenerator = $this->app->get(UrlGenerator::class); |
| 45 | 45 | return new SwaggerUiController($urlGenerator, __DIR__ . '/../../resources/open-api.html'); |
| 46 | 46 | } |
@@ -84,11 +84,11 @@ |
||
| 84 | 84 | |
| 85 | 85 | return array_filter( |
| 86 | 86 | array_map( |
| 87 | - function ($modelInstance) use (&$resourceClass) { |
|
| 87 | + function($modelInstance) use (&$resourceClass) { |
|
| 88 | 88 | return $this->denormalize($modelInstance->toArray(), $resourceClass); |
| 89 | 89 | }, iterator_to_array($modelInstances) |
| 90 | 90 | ), |
| 91 | - function ($resource) { |
|
| 91 | + function($resource) { |
|
| 92 | 92 | return $this->gate->allows('get', $resource); |
| 93 | 93 | } |
| 94 | 94 | ); |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | ); |
| 51 | 51 | } |
| 52 | 52 | $list = array_map( |
| 53 | - function (Status $statusModel) { |
|
| 53 | + function(Status $statusModel) { |
|
| 54 | 54 | return $this->convert($statusModel); |
| 55 | 55 | }, iterator_to_array($statuses) |
| 56 | 56 | ); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | { |
| 13 | 13 | parent::__construct( |
| 14 | 14 | 500, |
| 15 | - 'Resource ' . $resourceClass . ' misses ' . $options .' option in the ApiResource annotation' |
|
| 15 | + 'Resource ' . $resourceClass . ' misses ' . $options . ' option in the ApiResource annotation' |
|
| 16 | 16 | ); |
| 17 | 17 | } |
| 18 | 18 | } |