@@ -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(); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | public function register() |
| 87 | 87 | { |
| 88 | 88 | // fix for https://github.com/laravel/framework/issues/30415 |
| 89 | - $this->app->extend(ServerRequestInterface::class, function (ServerRequestInterface $psrRequest) { |
|
| 89 | + $this->app->extend(ServerRequestInterface::class, function(ServerRequestInterface $psrRequest) { |
|
| 90 | 90 | $route = $this->app->make('request')->route(); |
| 91 | 91 | if ($route) { |
| 92 | 92 | $parameters = $route->parameters(); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | return $psrRequest; |
| 98 | 98 | }); |
| 99 | - $this->app->singleton('apie.config', function () { |
|
| 99 | + $this->app->singleton('apie.config', function() { |
|
| 100 | 100 | $config = $this->app->get('config'); |
| 101 | 101 | |
| 102 | 102 | $resolver = new OptionsResolver(); |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | return $resolver->resolve($config->get('apie') ?? []); |
| 106 | 106 | }); |
| 107 | 107 | |
| 108 | - $this->app->singleton(ApiResourcesInterface::class, function () { |
|
| 108 | + $this->app->singleton(ApiResourcesInterface::class, function() { |
|
| 109 | 109 | $config = $this->app->get('apie.config'); |
| 110 | - if (! empty($config['resources-service'])) { |
|
| 110 | + if (!empty($config['resources-service'])) { |
|
| 111 | 111 | return $this->app->get($config['resources-service']); |
| 112 | 112 | } |
| 113 | 113 | if ($config['resources'] instanceof ApiResourcesInterface) { |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | return new ApiResources($config['resources']); |
| 117 | 117 | }); |
| 118 | 118 | |
| 119 | - $this->app->singleton(ServiceLibraryFactory::class, function () { |
|
| 119 | + $this->app->singleton(ServiceLibraryFactory::class, function() { |
|
| 120 | 120 | $config = $this->app->get('apie.config'); |
| 121 | 121 | $result = new ServiceLibraryFactory( |
| 122 | 122 | $this->app->get(ApiResourcesInterface::class), |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | storage_path('apie-cache') |
| 125 | 125 | ); |
| 126 | 126 | $result->setContainer($this->app); |
| 127 | - $result->runBeforeInstantiation(function () use (&$result) { |
|
| 127 | + $result->runBeforeInstantiation(function() use (&$result) { |
|
| 128 | 128 | $normalizers = [ |
| 129 | 129 | ]; |
| 130 | 130 | $taggedNormalizers = $this->app->tagged(NormalizerInterface::class); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | // OpenApiSpecGenerator: generated an OpenAPI 3.0 spec file from a list of resources. |
| 166 | 166 | $this->addOpenApiServices(); |
| 167 | - $this->app->singleton(OpenApiSpecGenerator::class, function () { |
|
| 167 | + $this->app->singleton(OpenApiSpecGenerator::class, function() { |
|
| 168 | 168 | $config = $this->app->get('apie.config'); |
| 169 | 169 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 170 | 170 | $baseUrl = $config['base-url'] . $config['api-url']; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | }); |
| 178 | 178 | |
| 179 | 179 | // SchemaGenerator: generates a OpenAPI Schema from a api resource class. |
| 180 | - $this->app->singleton(SchemaGenerator::class, function () { |
|
| 180 | + $this->app->singleton(SchemaGenerator::class, function() { |
|
| 181 | 181 | $factory = $this->app->get(ServiceLibraryFactory::class); |
| 182 | 182 | $service = $factory->getSchemaGenerator(); |
| 183 | 183 | $service->defineSchemaForResource(Uuid::class, new Schema(['type' => 'string', 'format' => 'uuid'])); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | return $service; |
| 186 | 186 | }); |
| 187 | 187 | |
| 188 | - $this->app->singleton(Serializer::class, function () { |
|
| 188 | + $this->app->singleton(Serializer::class, function() { |
|
| 189 | 189 | return $this->app->get(ServiceLibraryFactory::class)->getSerializer(); |
| 190 | 190 | }); |
| 191 | 191 | $this->app->bind(SerializerInterface::class, Serializer::class); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $this->app->singleton(CamelCaseToSnakeCaseNameConverter::class); |
| 195 | 195 | $this->app->bind(NameConverterInterface::class, CamelCaseToSnakeCaseNameConverter::class); |
| 196 | 196 | |
| 197 | - $this->app->singleton(AppRetriever::class, function () { |
|
| 197 | + $this->app->singleton(AppRetriever::class, function() { |
|
| 198 | 198 | $config = $this->app->get('apie.config'); |
| 199 | 199 | return new AppRetriever( |
| 200 | 200 | config('app.name'), |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | }); |
| 206 | 206 | $this->app->singleton(EloquentModelRetriever::class); |
| 207 | 207 | $this->app->singleton(DatabaseQueryRetriever::class); |
| 208 | - $this->app->singleton(FileStorageRetriever::class, function () { |
|
| 208 | + $this->app->singleton(FileStorageRetriever::class, function() { |
|
| 209 | 209 | return new FileStorageRetriever( |
| 210 | 210 | storage_path('api-file-storage'), |
| 211 | 211 | $this->app->get(ServiceLibraryFactory::class)->getPropertyAccessor() |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | }); |
| 214 | 214 | |
| 215 | 215 | // ApiResourceFacade: class that calls all the right services with a simple interface. |
| 216 | - $this->app->singleton(ApiResourceFacade::class, function () { |
|
| 216 | + $this->app->singleton(ApiResourceFacade::class, function() { |
|
| 217 | 217 | return $this->app->get(ServiceLibraryFactory::class)->getApiResourceFacade(); |
| 218 | 218 | }); |
| 219 | 219 | |
| 220 | - $this->app->bind(SwaggerUiController::class, function () { |
|
| 220 | + $this->app->bind(SwaggerUiController::class, function() { |
|
| 221 | 221 | if ($this->app->has(UrlGenerator::class)) { |
| 222 | 222 | $urlGenerator = $this->app->get(UrlGenerator::class); |
| 223 | 223 | } else { |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | private function addOpenApiServices() |
| 233 | 233 | { |
| 234 | 234 | // Provides contact information to the OpenAPI spec. |
| 235 | - $this->app->singleton(Contact::class, function () { |
|
| 235 | + $this->app->singleton(Contact::class, function() { |
|
| 236 | 236 | $config = $this->app->get('apie.config'); |
| 237 | 237 | return new Contact([ |
| 238 | 238 | 'name' => $config['metadata']['contact-name'], |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | }); |
| 243 | 243 | |
| 244 | 244 | // Provides license information to the OpenAPI spec. |
| 245 | - $this->app->singleton(License::class, function () { |
|
| 245 | + $this->app->singleton(License::class, function() { |
|
| 246 | 246 | $config = $this->app->get('apie.config'); |
| 247 | 247 | return new License( |
| 248 | 248 | $config['metadata']['license'], |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | }); |
| 252 | 252 | |
| 253 | 253 | // Provides OpenAPI info to the OpenAPI spec. |
| 254 | - $this->app->singleton(Info::class, function () { |
|
| 254 | + $this->app->singleton(Info::class, function() { |
|
| 255 | 255 | $config = $this->app->get('apie.config'); |
| 256 | 256 | return new Info( |
| 257 | 257 | $config['metadata']['title'], |
@@ -267,11 +267,11 @@ discard block |
||
| 267 | 267 | |
| 268 | 268 | private function addStatusResourceServices() |
| 269 | 269 | { |
| 270 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
| 270 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
| 271 | 271 | return new StatusFromDatabaseRetriever(config('app.debug')); |
| 272 | 272 | }); |
| 273 | 273 | $this->app->tag([StatusFromDatabaseRetriever::class], 'status-check'); |
| 274 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
| 274 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
| 275 | 275 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
| 276 | 276 | }); |
| 277 | 277 | } |
@@ -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'); |