Passed
Push — master ( 715c70...91c54f )
by
unknown
04:18
created
src/Providers/ApiResourceServiceProvider.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     public function register()
85 85
     {
86 86
         // fix for https://github.com/laravel/framework/issues/30415
87
-        $this->app->extend(ServerRequestInterface::class, function (ServerRequestInterface $psrRequest) {
87
+        $this->app->extend(ServerRequestInterface::class, function(ServerRequestInterface $psrRequest) {
88 88
             $route = $this->app->make('request')->route();
89 89
             if ($route) {
90 90
                 $parameters = $route->parameters();
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             }
95 95
             return $psrRequest;
96 96
         });
97
-        $this->app->singleton('apie.config', function () {
97
+        $this->app->singleton('apie.config', function() {
98 98
             $config = $this->app->get('config');
99 99
 
100 100
             $resolver = new OptionsResolver();
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
             return $resolver->resolve($config->get('apie') ?? []);
104 104
         });
105 105
 
106
-        $this->app->singleton(ApiResourcesInterface::class, function () {
106
+        $this->app->singleton(ApiResourcesInterface::class, function() {
107 107
             $config = $this->app->get('apie.config');
108
-            if (! empty($config['resources-service'])) {
108
+            if (!empty($config['resources-service'])) {
109 109
                 return $this->app->get($config['resources-service']);
110 110
             }
111 111
             if ($config['resources'] instanceof ApiResourcesInterface) {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             return new ApiResources($config['resources']);
115 115
         });
116 116
 
117
-        $this->app->singleton(ServiceLibraryFactory::class, function () {
117
+        $this->app->singleton(ServiceLibraryFactory::class, function() {
118 118
             $config = $this->app->get('apie.config');
119 119
             $result = new ServiceLibraryFactory(
120 120
                 $this->app->get(ApiResourcesInterface::class),
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                 storage_path('apie-cache')
123 123
             );
124 124
             $result->setContainer($this->app);
125
-            $result->runBeforeInstantiation(function () use (&$result) {
125
+            $result->runBeforeInstantiation(function() use (&$result) {
126 126
                 $normalizers = [
127 127
                 ];
128 128
                 $taggedNormalizers = $this->app->tagged(NormalizerInterface::class);
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
         // OpenApiSpecGenerator: generated an OpenAPI 3.0 spec file from a list of resources.
164 164
         $this->addOpenApiServices();
165
-        $this->app->singleton(OpenApiSpecGenerator::class, function () {
165
+        $this->app->singleton(OpenApiSpecGenerator::class, function() {
166 166
             $config = $this->app->get('apie.config');
167 167
             $factory = $this->app->get(ServiceLibraryFactory::class);
168 168
             $baseUrl = $config['base-url'] . $config['api-url'];
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         });
176 176
 
177 177
         // SchemaGenerator: generates a OpenAPI Schema from a api resource class.
178
-        $this->app->singleton(SchemaGenerator::class, function () {
178
+        $this->app->singleton(SchemaGenerator::class, function() {
179 179
             $factory = $this->app->get(ServiceLibraryFactory::class);
180 180
             $service = $factory->getSchemaGenerator();
181 181
             $service->defineSchemaForResource(Uuid::class, new Schema(['type' => 'string', 'format' => 'uuid']));
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             return $service;
184 184
         });
185 185
 
186
-        $this->app->singleton(Serializer::class, function () {
186
+        $this->app->singleton(Serializer::class, function() {
187 187
             return $this->app->get(ServiceLibraryFactory::class)->getSerializer();
188 188
         });
189 189
         $this->app->bind(SerializerInterface::class, Serializer::class);
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         $this->app->singleton(CamelCaseToSnakeCaseNameConverter::class);
193 193
         $this->app->bind(NameConverterInterface::class, CamelCaseToSnakeCaseNameConverter::class);
194 194
 
195
-        $this->app->singleton(AppRetriever::class, function () {
195
+        $this->app->singleton(AppRetriever::class, function() {
196 196
             $config = $this->app->get('apie.config');
197 197
             return new AppRetriever(
198 198
                 config('app.name'),
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         });
204 204
         $this->app->singleton(EloquentModelRetriever::class);
205 205
         $this->app->singleton(DatabaseQueryRetriever::class);
206
-        $this->app->singleton(FileStorageRetriever::class, function () {
206
+        $this->app->singleton(FileStorageRetriever::class, function() {
207 207
             return new FileStorageRetriever(
208 208
                 storage_path('api-file-storage'),
209 209
                 $this->app->get(ServiceLibraryFactory::class)->getPropertyAccessor()
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
         });
212 212
 
213 213
         // ApiResourceFacade: class that calls all the right services with a simple interface.
214
-        $this->app->singleton(ApiResourceFacade::class, function () {
214
+        $this->app->singleton(ApiResourceFacade::class, function() {
215 215
             return $this->app->get(ServiceLibraryFactory::class)->getApiResourceFacade();
216 216
         });
217 217
 
218
-        $this->app->bind(SwaggerUiController::class, function () {
218
+        $this->app->bind(SwaggerUiController::class, function() {
219 219
             if ($this->app->has(UrlGenerator::class)) {
220 220
                 $urlGenerator = $this->app->get(UrlGenerator::class);
221 221
             } else {
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     private function addOpenApiServices()
231 231
     {
232 232
         // Provides contact information to the OpenAPI spec.
233
-        $this->app->singleton(Contact::class, function () {
233
+        $this->app->singleton(Contact::class, function() {
234 234
             $config = $this->app->get('apie.config');
235 235
             return new Contact([
236 236
                 'name'  => $config['metadata']['contact-name'],
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         });
241 241
 
242 242
         // Provides license information to the OpenAPI spec.
243
-        $this->app->singleton(License::class, function () {
243
+        $this->app->singleton(License::class, function() {
244 244
             $config = $this->app->get('apie.config');
245 245
             return new License(
246 246
                 $config['metadata']['license'],
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         });
250 250
 
251 251
         // Provides OpenAPI info to the OpenAPI spec.
252
-        $this->app->singleton(Info::class, function () {
252
+        $this->app->singleton(Info::class, function() {
253 253
             $config = $this->app->get('apie.config');
254 254
             return new Info(
255 255
                 $config['metadata']['title'],
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 
266 266
     private function addStatusResourceServices()
267 267
     {
268
-        $this->app->singleton(StatusFromDatabaseRetriever::class, function () {
268
+        $this->app->singleton(StatusFromDatabaseRetriever::class, function() {
269 269
             return new StatusFromDatabaseRetriever(config('app.debug'));
270 270
         });
271 271
         $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']);
272
-        $this->app->singleton(StatusCheckRetriever::class, function () {
272
+        $this->app->singleton(StatusCheckRetriever::class, function() {
273 273
             return new StatusCheckRetriever($this->app->tagged('status-check'));
274 274
         });
275 275
     }
Please login to merge, or discard this patch.