Passed
Branch feature/metadata-options (233e6e)
by Pieter
02:46
created
migrations/2019_07_09_090117_make_status_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
config/routes-lumen.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
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]);
Please login to merge, or discard this patch.
config/routes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
src/Providers/ApieLumenServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
src/Services/StatusChecks/StatusFromDatabaseRetriever.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
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
         );
Please login to merge, or discard this patch.
src/Exceptions/ApiResourceContextException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Services/Retrievers/EloquentModelDataLayer.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,9 +63,9 @@
 block discarded – undo
63 63
         $queryBuilder = $modelClass::where($searchFilterRequest->getSearches());
64 64
 
65 65
         $modelInstances = $queryBuilder->orderBy('id', 'ASC')
66
-                                     ->skip($searchFilterRequest->getOffset())
67
-                                     ->take($searchFilterRequest->getNumberOfItems())
68
-                                     ->get();
66
+                                        ->skip($searchFilterRequest->getOffset())
67
+                                        ->take($searchFilterRequest->getNumberOfItems())
68
+                                        ->get();
69 69
 
70 70
         return array_filter(
71 71
             array_map(
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,11 +84,11 @@
 block discarded – undo
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
         );
Please login to merge, or discard this patch.
src/Providers/ApieLaravelServiceProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Providers/ApiResourceServiceProvider.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
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
             return ApieConfigResolver::resolveConfig($config->get('apie') ?? []);
72 72
         });
73 73
 
74
-        $this->app->singleton(ApiResourcesInterface::class, function () {
74
+        $this->app->singleton(ApiResourcesInterface::class, function() {
75 75
             $config = $this->app->get('apie.config');
76
-            if (! empty($config['resources-service'])) {
76
+            if (!empty($config['resources-service'])) {
77 77
                 return $this->app->get($config['resources-service']);
78 78
             }
79 79
             if ($config['resources'] instanceof ApiResourcesInterface) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             return new ApiResources($config['resources']);
83 83
         });
84 84
 
85
-        $this->app->singleton(ServiceLibraryFactory::class, function () {
85
+        $this->app->singleton(ServiceLibraryFactory::class, function() {
86 86
             return $this->createServiceLibraryFactory();
87 87
         });
88 88
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
         // OpenApiSpecGenerator: generated an OpenAPI 3.0 spec file from a list of resources.
95 95
         $this->addOpenApiServices();
96
-        $this->app->singleton(OpenApiSpecGenerator::class, function () {
96
+        $this->app->singleton(OpenApiSpecGenerator::class, function() {
97 97
             $config = $this->app->get('apie.config');
98 98
             $factory = $this->app->get(ServiceLibraryFactory::class);
99 99
             $baseUrl = $config['base-url'] . $config['api-url'];
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         });
107 107
 
108 108
         // SchemaGenerator: generates a OpenAPI Schema from a api resource class.
109
-        $this->app->singleton(SchemaGenerator::class, function () {
109
+        $this->app->singleton(SchemaGenerator::class, function() {
110 110
             $factory = $this->app->get(ServiceLibraryFactory::class);
111 111
             $service = $factory->getSchemaGenerator();
112 112
             $service->defineSchemaForResource(Uuid::class, new Schema(['type' => 'string', 'format' => 'uuid']));
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             return $service;
115 115
         });
116 116
 
117
-        $this->app->singleton(Serializer::class, function () {
117
+        $this->app->singleton(Serializer::class, function() {
118 118
             return $this->app->get(ServiceLibraryFactory::class)->getSerializer();
119 119
         });
120 120
         $this->app->bind(SerializerInterface::class, Serializer::class);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         $this->app->singleton(CamelCaseToSnakeCaseNameConverter::class);
124 124
         $this->app->bind(NameConverterInterface::class, CamelCaseToSnakeCaseNameConverter::class);
125 125
 
126
-        $this->app->singleton(ApplicationInfoRetriever::class, function () {
126
+        $this->app->singleton(ApplicationInfoRetriever::class, function() {
127 127
             $config = $this->app->get('apie.config');
128 128
             return new ApplicationInfoRetriever(
129 129
                 config('app.name'),
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         });
135 135
         $this->app->singleton(EloquentModelDataLayer::class);
136 136
         $this->app->singleton(DatabaseQueryRetriever::class);
137
-        $this->app->singleton(FileStorageDataLayer::class, function () {
137
+        $this->app->singleton(FileStorageDataLayer::class, function() {
138 138
             return new FileStorageDataLayer(
139 139
                 storage_path('app/api-file-storage'),
140 140
                 $this->app->get(ServiceLibraryFactory::class)->getPropertyAccessor()
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         });
143 143
 
144 144
         // ApiResourceFacade: class that calls all the right services with a simple interface.
145
-        $this->app->singleton(ApiResourceFacade::class, function () {
145
+        $this->app->singleton(ApiResourceFacade::class, function() {
146 146
             return $this->app->get(ServiceLibraryFactory::class)->getApiResourceFacade();
147 147
         });
148 148
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     private function addOpenApiServices()
159 159
     {
160 160
         // Provides contact information to the OpenAPI spec.
161
-        $this->app->singleton(Contact::class, function () {
161
+        $this->app->singleton(Contact::class, function() {
162 162
             $config = $this->app->get('apie.config');
163 163
             return new Contact([
164 164
                 'name'  => $config['metadata']['contact-name'],
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         });
169 169
 
170 170
         // Provides license information to the OpenAPI spec.
171
-        $this->app->singleton(License::class, function () {
171
+        $this->app->singleton(License::class, function() {
172 172
             $config = $this->app->get('apie.config');
173 173
             return new License(
174 174
                 $config['metadata']['license'],
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         });
178 178
 
179 179
         // Provides OpenAPI info to the OpenAPI spec.
180
-        $this->app->singleton(Info::class, function () {
180
+        $this->app->singleton(Info::class, function() {
181 181
             $config = $this->app->get('apie.config');
182 182
             return new Info(
183 183
                 $config['metadata']['title'],
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         if (!config('app.debug')) {
204 204
             $this->handleSerializerCache($result);
205 205
         }
206
-        $result->runBeforeInstantiation(function () use (&$result) {
206
+        $result->runBeforeInstantiation(function() use (&$result) {
207 207
             $normalizers = [
208 208
             ];
209 209
             $taggedNormalizers = $this->app->tagged(NormalizerInterface::class);
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 
246 246
     private function addStatusResourceServices()
247 247
     {
248
-        $this->app->singleton(StatusFromDatabaseRetriever::class, function () {
248
+        $this->app->singleton(StatusFromDatabaseRetriever::class, function() {
249 249
             return new StatusFromDatabaseRetriever(config('app.debug'));
250 250
         });
251 251
         $this->app->tag([StatusFromDatabaseRetriever::class], ['status-check']);
252
-        $this->app->singleton(StatusCheckRetriever::class, function () {
252
+        $this->app->singleton(StatusCheckRetriever::class, function() {
253 253
             return new StatusCheckRetriever($this->app->tagged('status-check'));
254 254
         });
255 255
     }
Please login to merge, or discard this patch.