@@ -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(); |
@@ -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 | } |
@@ -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 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | // fix for https://github.com/laravel/framework/issues/30415 |
38 | 38 | $this->app->extend( |
39 | 39 | ServerRequestInterface::class, |
40 | - function (ServerRequestInterface $psrRequest) { |
|
40 | + function(ServerRequestInterface $psrRequest) { |
|
41 | 41 | $route = $this->app->make('request')->route(); |
42 | 42 | if ($route) { |
43 | 43 | $parameters = $route->parameters(); |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | |
54 | 54 | $this->app->bind( |
55 | 55 | SwaggerUiController::class, |
56 | - function () { |
|
56 | + function() { |
|
57 | 57 | $urlGenerator = $this->app->get(UrlGenerator::class); |
58 | 58 | return new SwaggerUiController($urlGenerator, __DIR__ . '/../../resources/open-api.html'); |
59 | 59 | } |
60 | 60 | ); |
61 | 61 | |
62 | - $this->app->bind(ApiResourceFacadeResponse::class, function () { |
|
62 | + $this->app->bind(ApiResourceFacadeResponse::class, function() { |
|
63 | 63 | /** @var ServerRequestInterface $request */ |
64 | 64 | $request = $this->app->get(ServerRequestInterface::class); |
65 | 65 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | public function registerResourceClass(string $resourceClass) |
74 | 74 | { |
75 | - $this->app->bind($resourceClass, function () use ($resourceClass) { |
|
75 | + $this->app->bind($resourceClass, function() use ($resourceClass) { |
|
76 | 76 | /** @var ServerRequestInterface $request */ |
77 | 77 | $request = $this->app->get(ServerRequestInterface::class); |
78 | 78 |
@@ -77,6 +77,6 @@ |
||
77 | 77 | * @see ApiResource |
78 | 78 | */ |
79 | 79 | 'resource-config' => [ |
80 | - /*ApplicationInfo::class => ['retrieveClass' => StatusCheckRetriever::class],*/ |
|
80 | + /*ApplicationInfo::class => ['retrieveClass' => StatusCheckRetriever::class],*/ |
|
81 | 81 | ], |
82 | 82 | ]; |
@@ -10,11 +10,11 @@ |
||
10 | 10 | |
11 | 11 | $apieConfig = app('apie.config'); |
12 | 12 | |
13 | -$router->group(['prefix' => $apieConfig['api-url'], 'middleware' => $apieConfig['swagger-ui-test-page-middleware']], function () use ($router) { |
|
13 | +$router->group(['prefix' => $apieConfig['api-url'], 'middleware' => $apieConfig['swagger-ui-test-page-middleware']], function() use ($router) { |
|
14 | 14 | $router->get('/doc.json', ['as' => 'apie.docs', 'uses' => DocsController::class]); |
15 | 15 | }); |
16 | 16 | |
17 | -$router->group(['prefix' => $apieConfig['api-url'], 'middleware' => $apieConfig['apie-middleware']], function () use ($router) { |
|
17 | +$router->group(['prefix' => $apieConfig['api-url'], 'middleware' => $apieConfig['apie-middleware']], function() use ($router) { |
|
18 | 18 | $router->post('/{resource}/', ['as' => 'apie.post', 'uses' => PostController::class]); |
19 | 19 | $router->put('/{resource}/{id}', ['as' => 'apie.put', 'uses' => PutController::class]); |
20 | 20 | $router->get('/{resource}/', ['as' => 'apie.all', 'uses' => GetAllController::class]); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | 'prefix' => $apieConfig['api-url'], |
14 | 14 | 'middleware' => $apieConfig['swagger-ui-test-page-middleware'] |
15 | 15 | ], |
16 | - function () { |
|
16 | + function() { |
|
17 | 17 | Route::get('/doc.json', DocsController::class)->name('apie.docs'); |
18 | 18 | } |
19 | 19 | ); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | 'prefix' => $apieConfig['api-url'], |
24 | 24 | 'middleware' => $apieConfig['apie-middleware'] |
25 | 25 | ], |
26 | - function () { |
|
26 | + function() { |
|
27 | 27 | Route::post('/{resource}/', PostController::class)->name('apie.post'); |
28 | 28 | Route::put('/{resource}/{id}', PutController::class)->name('apie.put'); |
29 | 29 | Route::get('/{resource}/', GetAllController::class)->name('apie.all'); |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | ->setAllowedTypes('metadata', 'string[]') |
46 | 46 | ->setAllowedTypes('resource-config', [ApiResource::class . '[]', 'array[]']) |
47 | 47 | ->setAllowedTypes('exception-mapping', 'int[]'); |
48 | - $resolver->setDefault('metadata', function (OptionsResolver $metadataResolver) use (&$defaults) { |
|
48 | + $resolver->setDefault('metadata', function(OptionsResolver $metadataResolver) use (&$defaults) { |
|
49 | 49 | $metadataResolver->setDefaults($defaults['metadata']); |
50 | 50 | |
51 | - $urlNormalizer = function (Options $options, $value) { |
|
51 | + $urlNormalizer = function(Options $options, $value) { |
|
52 | 52 | if (empty($value)) { |
53 | 53 | return ''; |
54 | 54 | } |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | $metadataResolver->setNormalizer('license-url', $urlNormalizer); |
59 | 59 | $metadataResolver->setNormalizer('contact-url', $urlNormalizer); |
60 | 60 | }); |
61 | - $resolver->setNormalizer('resource-config', function (Options $options, $value) { |
|
62 | - return array_map(function ($field) { |
|
61 | + $resolver->setNormalizer('resource-config', function(Options $options, $value) { |
|
62 | + return array_map(function($field) { |
|
63 | 63 | return $field instanceof ApiResource ? $field : ApiResource::createFromArray($field); |
64 | 64 | }, $value); |
65 | 65 | }); |
66 | - $resolver->setNormalizer('exception-mapping', function (Options $options, $value) { |
|
66 | + $resolver->setNormalizer('exception-mapping', function(Options $options, $value) { |
|
67 | 67 | ApieConfigResolver::addExceptionsForExceptionMapping($value); |
68 | 68 | return $value; |
69 | 69 | }); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | private static function urlNormalize($value) |
89 | 89 | { |
90 | 90 | if ('http://' !== substr($value, 0, 7) && 'https://' !== substr($value, 0, 8)) { |
91 | - $value = 'https://'.$value; |
|
91 | + $value = 'https://' . $value; |
|
92 | 92 | } |
93 | 93 | $parsedUrl = parse_url($value); |
94 | 94 | if (empty($parsedUrl) || !in_array($parsedUrl['scheme'], ['http', 'https']) || !filter_var($value, FILTER_VALIDATE_URL)) { |
@@ -60,23 +60,23 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function register() |
62 | 62 | { |
63 | - $this->app->singleton('apie.config', function () { |
|
63 | + $this->app->singleton('apie.config', function() { |
|
64 | 64 | $config = $this->app->get('config'); |
65 | 65 | return ApieConfigResolver::resolveConfig($config->get('apie') ?? []); |
66 | 66 | }); |
67 | 67 | |
68 | - $this->app->singleton(ApiResourcesInterface::class, function () { |
|
68 | + $this->app->singleton(ApiResourcesInterface::class, function() { |
|
69 | 69 | return new ApiResources($this->app->get(Apie::class)->getResources()); |
70 | 70 | }); |
71 | 71 | |
72 | - $this->app->singleton(Apie::class, function () { |
|
72 | + $this->app->singleton(Apie::class, function() { |
|
73 | 73 | $plugins = $this->app->get('apie.plugins'); |
74 | 74 | $debug = (bool) config('app.debug'); |
75 | 75 | $cacheFolder = storage_path('app/apie-cache'); |
76 | 76 | return DefaultApie::createDefaultApie($debug, $plugins, $cacheFolder, false); |
77 | 77 | }); |
78 | 78 | |
79 | - $this->app->singleton('apie.plugins', function () { |
|
79 | + $this->app->singleton('apie.plugins', function() { |
|
80 | 80 | $plugins = (array) $this->app->tagged(Apie::class); |
81 | 81 | $config = $this->app->get('apie.config'); |
82 | 82 | if (!empty($config['mock'])) { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | $this->bindApieServices(); |
104 | 104 | |
105 | - $this->app->singleton(ApplicationInfoRetriever::class, function () { |
|
105 | + $this->app->singleton(ApplicationInfoRetriever::class, function() { |
|
106 | 106 | $config = $this->app->get('apie.config'); |
107 | 107 | return new ApplicationInfoRetriever( |
108 | 108 | config('app.name'), |
@@ -111,21 +111,21 @@ discard block |
||
111 | 111 | config('app.debug') |
112 | 112 | ); |
113 | 113 | }); |
114 | - $this->app->singleton(FileStorageDataLayer::class, function () { |
|
114 | + $this->app->singleton(FileStorageDataLayer::class, function() { |
|
115 | 115 | return new FileStorageDataLayer( |
116 | 116 | storage_path('app/api-file-storage'), |
117 | 117 | $this->app->get(Apie::class)->getPropertyAccessor() |
118 | 118 | ); |
119 | 119 | }); |
120 | 120 | |
121 | - $this->app->singleton(ApieExceptionToResponse::class, function () { |
|
121 | + $this->app->singleton(ApieExceptionToResponse::class, function() { |
|
122 | 122 | $mapping = $this->app->get('apie.config')['exception-mapping']; |
123 | 123 | return new ApieExceptionToResponse(resolve(HttpFoundationFactory::class), $mapping); |
124 | 124 | }); |
125 | 125 | |
126 | - $this->app->singleton(Serializer::class, function () { |
|
126 | + $this->app->singleton(Serializer::class, function() { |
|
127 | 127 | $serializer = $this->app->get(ResourceSerializerInterface::class); |
128 | - if (! ($serializer instanceof SymfonySerializerAdapter)) { |
|
128 | + if (!($serializer instanceof SymfonySerializerAdapter)) { |
|
129 | 129 | throw new InvalidClassTypeException('resource serializer', SymfonySerializerAdapter::class); |
130 | 130 | } |
131 | 131 | return $serializer->getSerializer(); |
@@ -151,18 +151,18 @@ discard block |
||
151 | 151 | |
152 | 152 | private function registerApieService(string $serviceName, string $methodName) |
153 | 153 | { |
154 | - $this->app->bind($serviceName, function () use ($methodName) { |
|
154 | + $this->app->bind($serviceName, function() use ($methodName) { |
|
155 | 155 | return $this->app->get(Apie::class)->$methodName(); |
156 | 156 | }); |
157 | 157 | } |
158 | 158 | |
159 | 159 | private function addStatusResourceServices() |
160 | 160 | { |
161 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
161 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
162 | 162 | return new StatusFromDatabaseRetriever(config('app.debug')); |
163 | 163 | }); |
164 | 164 | $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']); |
165 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
165 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
166 | 166 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
167 | 167 | }); |
168 | 168 | } |