@@ -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 |
@@ -52,7 +52,7 @@ |
||
52 | 52 | $modelInstances = $builder->get(); |
53 | 53 | |
54 | 54 | return array_map( |
55 | - function ($modelInstance) use (&$resourceClass) { |
|
55 | + function($modelInstance) use (&$resourceClass) { |
|
56 | 56 | return $this->toResource($modelInstance, $resourceClass); |
57 | 57 | }, |
58 | 58 | iterator_to_array($modelInstances) |
@@ -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 | ); |
@@ -84,7 +84,7 @@ |
||
84 | 84 | * @see ApiResource |
85 | 85 | */ |
86 | 86 | 'resource-config' => [ |
87 | - /*ApplicationInfo::class => ['retrieveClass' => StatusCheckRetriever::class],*/ |
|
87 | + /*ApplicationInfo::class => ['retrieveClass' => StatusCheckRetriever::class],*/ |
|
88 | 88 | ], |
89 | 89 | |
90 | 90 | /** |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | ->setAllowedTypes('metadata', 'string[]') |
47 | 47 | ->setAllowedTypes('resource-config', [ApiResource::class . '[]', 'array[]']) |
48 | 48 | ->setAllowedTypes('exception-mapping', 'int[]'); |
49 | - $resolver->setDefault('metadata', function (OptionsResolver $metadataResolver) use (&$defaults) { |
|
49 | + $resolver->setDefault('metadata', function(OptionsResolver $metadataResolver) use (&$defaults) { |
|
50 | 50 | $metadataResolver->setDefaults($defaults['metadata']); |
51 | 51 | |
52 | - $urlNormalizer = function (Options $options, $value) { |
|
52 | + $urlNormalizer = function(Options $options, $value) { |
|
53 | 53 | if (empty($value)) { |
54 | 54 | return ''; |
55 | 55 | } |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | $metadataResolver->setNormalizer('license-url', $urlNormalizer); |
60 | 60 | $metadataResolver->setNormalizer('contact-url', $urlNormalizer); |
61 | 61 | }); |
62 | - $resolver->setNormalizer('resource-config', function (Options $options, $value) { |
|
63 | - return array_map(function ($field) { |
|
62 | + $resolver->setNormalizer('resource-config', function(Options $options, $value) { |
|
63 | + return array_map(function($field) { |
|
64 | 64 | return $field instanceof ApiResource ? $field : ApiResource::createFromArray($field); |
65 | 65 | }, $value); |
66 | 66 | }); |
67 | - $resolver->setNormalizer('contexts', function (Options $options, $value) { |
|
68 | - return array_map(function ($field) use ($options) { |
|
67 | + $resolver->setNormalizer('contexts', function(Options $options, $value) { |
|
68 | + return array_map(function($field) use ($options) { |
|
69 | 69 | return self::getResolver((array) $options)->resolve($field); |
70 | 70 | }, $value); |
71 | 71 | }); |
72 | - $resolver->setNormalizer('exception-mapping', function (Options $options, $value) { |
|
72 | + $resolver->setNormalizer('exception-mapping', function(Options $options, $value) { |
|
73 | 73 | ApieConfigResolver::addExceptionsForExceptionMapping($value); |
74 | 74 | return $value; |
75 | 75 | }); |
@@ -60,18 +60,18 @@ 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 | $res = ApieConfigResolver::resolveConfig($config->get('apie') ?? []); |
66 | 66 | $config->set('apie', $res); |
67 | 67 | return $res; |
68 | 68 | }); |
69 | 69 | |
70 | - $this->app->singleton(ApiResourcesInterface::class, function () { |
|
70 | + $this->app->singleton(ApiResourcesInterface::class, function() { |
|
71 | 71 | return new ApiResources($this->app->get(Apie::class)->getResources()); |
72 | 72 | }); |
73 | 73 | |
74 | - $this->app->singleton(ApieContext::class, function () { |
|
74 | + $this->app->singleton(ApieContext::class, function() { |
|
75 | 75 | $plugins = $this->app->get('apie.plugins'); |
76 | 76 | $debug = (bool) config('app.debug'); |
77 | 77 | $config = $this->app->get('apie.config'); |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | return new ApieContext($this->app, $apie, $config, $config['contexts']); |
81 | 81 | }); |
82 | 82 | |
83 | - $this->app->bind(Apie::class, function () { |
|
83 | + $this->app->bind(Apie::class, function() { |
|
84 | 84 | /** @var ApieContext $context */ |
85 | 85 | $context = $this->app->get(ApieContext::class)->getActiveContext(); |
86 | 86 | return $context->getApie(); |
87 | 87 | }); |
88 | 88 | |
89 | - $this->app->singleton('apie.plugins', function () { |
|
89 | + $this->app->singleton('apie.plugins', function() { |
|
90 | 90 | $plugins = (array) $this->app->tagged(Apie::class); |
91 | 91 | $config = $this->app->get('apie.config'); |
92 | 92 | if (!empty($config['mock'])) { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $this->bindApieServices(); |
114 | 114 | |
115 | - $this->app->singleton(ApplicationInfoRetriever::class, function () { |
|
115 | + $this->app->singleton(ApplicationInfoRetriever::class, function() { |
|
116 | 116 | $config = $this->app->get('apie.config'); |
117 | 117 | return new ApplicationInfoRetriever( |
118 | 118 | config('app.name'), |
@@ -121,21 +121,21 @@ discard block |
||
121 | 121 | config('app.debug') |
122 | 122 | ); |
123 | 123 | }); |
124 | - $this->app->singleton(FileStorageDataLayer::class, function () { |
|
124 | + $this->app->singleton(FileStorageDataLayer::class, function() { |
|
125 | 125 | return new FileStorageDataLayer( |
126 | 126 | storage_path('app/api-file-storage'), |
127 | 127 | $this->app->get(Apie::class)->getPropertyAccessor() |
128 | 128 | ); |
129 | 129 | }); |
130 | 130 | |
131 | - $this->app->singleton(ApieExceptionToResponse::class, function () { |
|
131 | + $this->app->singleton(ApieExceptionToResponse::class, function() { |
|
132 | 132 | $mapping = $this->app->get('apie.config')['exception-mapping']; |
133 | 133 | return new ApieExceptionToResponse(resolve(HttpFoundationFactory::class), $mapping); |
134 | 134 | }); |
135 | 135 | |
136 | - $this->app->singleton(Serializer::class, function () { |
|
136 | + $this->app->singleton(Serializer::class, function() { |
|
137 | 137 | $serializer = $this->app->get(ResourceSerializerInterface::class); |
138 | - if (! ($serializer instanceof SymfonySerializerAdapter)) { |
|
138 | + if (!($serializer instanceof SymfonySerializerAdapter)) { |
|
139 | 139 | throw new InvalidClassTypeException('resource serializer', SymfonySerializerAdapter::class); |
140 | 140 | } |
141 | 141 | return $serializer->getSerializer(); |
@@ -161,18 +161,18 @@ discard block |
||
161 | 161 | |
162 | 162 | private function registerApieService(string $serviceName, string $methodName) |
163 | 163 | { |
164 | - $this->app->bind($serviceName, function () use ($methodName) { |
|
164 | + $this->app->bind($serviceName, function() use ($methodName) { |
|
165 | 165 | return $this->app->get(Apie::class)->$methodName(); |
166 | 166 | }); |
167 | 167 | } |
168 | 168 | |
169 | 169 | private function addStatusResourceServices() |
170 | 170 | { |
171 | - $this->app->singleton(StatusFromDatabaseRetriever::class, function () { |
|
171 | + $this->app->singleton(StatusFromDatabaseRetriever::class, function() { |
|
172 | 172 | return new StatusFromDatabaseRetriever(config('app.debug')); |
173 | 173 | }); |
174 | 174 | $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']); |
175 | - $this->app->singleton(StatusCheckRetriever::class, function () { |
|
175 | + $this->app->singleton(StatusCheckRetriever::class, function() { |
|
176 | 176 | return new StatusCheckRetriever($this->app->tagged('status-check')); |
177 | 177 | }); |
178 | 178 | } |