@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | ); |
@@ -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(ServiceLibraryFactory::class, function () { |
|
| 89 | + $this->app->singleton(ServiceLibraryFactory::class, function() { |
|
| 90 | 90 | return $this->createServiceLibraryFactory(); |
| 91 | 91 | }); |
| 92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | // OpenApiSpecGenerator: generated an OpenAPI 3.0 spec file from a list of resources. |
| 99 | 99 | $this->addOpenApiServices(); |
| 100 | - $this->app->singleton(OpenApiSpecGenerator::class, function () { |
|
| 100 | + $this->app->singleton(OpenApiSpecGenerator::class, function() { |
|
| 101 | 101 | $config = $this->app->get('apie.config'); |
| 102 | 102 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 103 | 103 | $baseUrl = $config['base-url'] . $config['api-url']; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | }); |
| 111 | 111 | |
| 112 | 112 | // SchemaGenerator: generates a OpenAPI Schema from a api resource class. |
| 113 | - $this->app->singleton(SchemaGenerator::class, function () { |
|
| 113 | + $this->app->singleton(SchemaGenerator::class, function() { |
|
| 114 | 114 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 115 | 115 | $service = $factory->getSchemaGenerator(); |
| 116 | 116 | $service->defineSchemaForResource(Uuid::class, new Schema(['type' => 'string', 'format' => 'uuid'])); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | return $service; |
| 119 | 119 | }); |
| 120 | 120 | |
| 121 | - $this->app->singleton(Serializer::class, function () { |
|
| 121 | + $this->app->singleton(Serializer::class, function() { |
|
| 122 | 122 | return $this->app->get(ServiceLibraryFactory::class)->getSerializer(); |
| 123 | 123 | }); |
| 124 | 124 | $this->app->bind(SerializerInterface::class, Serializer::class); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $this->app->singleton(CamelCaseToSnakeCaseNameConverter::class); |
| 128 | 128 | $this->app->bind(NameConverterInterface::class, CamelCaseToSnakeCaseNameConverter::class); |
| 129 | 129 | |
| 130 | - $this->app->singleton(ApplicationInfoRetriever::class, function () { |
|
| 130 | + $this->app->singleton(ApplicationInfoRetriever::class, function() { |
|
| 131 | 131 | $config = $this->app->get('apie.config'); |
| 132 | 132 | return new ApplicationInfoRetriever( |
| 133 | 133 | config('app.name'), |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | }); |
| 139 | 139 | $this->app->singleton(EloquentModelDataLayer::class); |
| 140 | 140 | $this->app->singleton(DatabaseQueryRetriever::class); |
| 141 | - $this->app->singleton(FileStorageDataLayer::class, function () { |
|
| 141 | + $this->app->singleton(FileStorageDataLayer::class, function() { |
|
| 142 | 142 | return new FileStorageDataLayer( |
| 143 | 143 | storage_path('api-file-storage'), |
| 144 | 144 | $this->app->get(ServiceLibraryFactory::class)->getPropertyAccessor() |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | }); |
| 147 | 147 | |
| 148 | 148 | // ApiResourceFacade: class that calls all the right services with a simple interface. |
| 149 | - $this->app->singleton(ApiResourceFacade::class, function () { |
|
| 149 | + $this->app->singleton(ApiResourceFacade::class, function() { |
|
| 150 | 150 | return $this->app->get(ServiceLibraryFactory::class)->getApiResourceFacade(); |
| 151 | 151 | }); |
| 152 | 152 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | private function addOpenApiServices() |
| 163 | 163 | { |
| 164 | 164 | // Provides contact information to the OpenAPI spec. |
| 165 | - $this->app->singleton(Contact::class, function () { |
|
| 165 | + $this->app->singleton(Contact::class, function() { |
|
| 166 | 166 | $config = $this->app->get('apie.config'); |
| 167 | 167 | return new Contact([ |
| 168 | 168 | 'name' => $config['metadata']['contact-name'], |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | }); |
| 173 | 173 | |
| 174 | 174 | // Provides license information to the OpenAPI spec. |
| 175 | - $this->app->singleton(License::class, function () { |
|
| 175 | + $this->app->singleton(License::class, function() { |
|
| 176 | 176 | $config = $this->app->get('apie.config'); |
| 177 | 177 | return new License( |
| 178 | 178 | $config['metadata']['license'], |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | }); |
| 182 | 182 | |
| 183 | 183 | // Provides OpenAPI info to the OpenAPI spec. |
| 184 | - $this->app->singleton(Info::class, function () { |
|
| 184 | + $this->app->singleton(Info::class, function() { |
|
| 185 | 185 | $config = $this->app->get('apie.config'); |
| 186 | 186 | return new Info( |
| 187 | 187 | $config['metadata']['title'], |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | if (!config('app.debug')) { |
| 208 | 208 | $this->handleSerializerCache($result); |
| 209 | 209 | } |
| 210 | - $result->runBeforeInstantiation(function () use (&$result) { |
|
| 210 | + $result->runBeforeInstantiation(function() use (&$result) { |
|
| 211 | 211 | $normalizers = [ |
| 212 | 212 | ]; |
| 213 | 213 | $taggedNormalizers = $this->app->tagged(NormalizerInterface::class); |
@@ -249,11 +249,11 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | private function addStatusResourceServices() |
| 251 | 251 | { |
| 252 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
| 252 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
| 253 | 253 | return new StatusFromDatabaseRetriever(config('app.debug')); |
| 254 | 254 | }); |
| 255 | 255 | $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']); |
| 256 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
| 256 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
| 257 | 257 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
| 258 | 258 | }); |
| 259 | 259 | } |