Completed
Pull Request — master (#837)
by
unknown
20s
created
routes/laravel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 
8 8
 Route::namespace('\Mpociot\ApiDoc\Http')
9 9
     ->middleware($middleware)
10
-    ->group(function () use ($prefix) {
10
+    ->group(function() use ($prefix) {
11 11
         Route::get($prefix, 'Controller@html')->name('apidoc');
12 12
         Route::get("$prefix.json", 'Controller@json')->name('apidoc.json');
13 13
     });
Please login to merge, or discard this patch.
src/OwnLaravelPackageTemplateServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     public function boot()
15 15
     {
16 16
         // Load routes, views, migrations, etc.
17
-        $this->loadRoutesFrom(__DIR__.'/../routes/web.php');
17
+        $this->loadRoutesFrom(__DIR__ . '/../routes/web.php');
18 18
 
19 19
         // If the package provides any views
20 20
         // $this->loadViewsFrom(__DIR__.'/../resources/views', 'yourpackage');
Please login to merge, or discard this patch.
Backup/src/Matching/RouteMatcher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 
65 65
     private function getAllRoutes(bool $usingDingoRouter)
66 66
     {
67
-        if (! $usingDingoRouter) {
67
+        if (!$usingDingoRouter) {
68 68
             return RouteFacade::getRoutes();
69 69
         }
70 70
 
71 71
         $allRouteCollections = app(\Dingo\Api\Routing\Router::class)->getRoutes();
72 72
 
73 73
         return collect($allRouteCollections)
74
-            ->flatMap(function (RouteCollection $collection) {
74
+            ->flatMap(function(RouteCollection $collection) {
75 75
                 return $collection->getRoutes();
76 76
             })->toArray();
77 77
     }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     private function shouldIncludeRoute(Route $route, array $routeRule, array $mustIncludes, bool $usingDingoRouter)
80 80
     {
81 81
         $matchesVersion = $usingDingoRouter
82
-            ? ! empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? []))
82
+            ? !empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? []))
83 83
             : true;
84 84
 
85 85
         return Str::is($mustIncludes, $route->getName())
Please login to merge, or discard this patch.
Backup/src/Extracting/RouteDocBlocker.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 
21 21
         $class = new ReflectionClass($className);
22 22
 
23
-        if (! $class->hasMethod($methodName)) {
23
+        if (!$class->hasMethod($methodName)) {
24 24
             throw new \Exception("Error while fetching docblock for route: Class $className does not contain method $methodName");
25 25
         }
26 26
 
Please login to merge, or discard this patch.
Backup/src/Extracting/Generator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
         $responses = $this->fetchResponses($controller, $method, $route, $routeRules, $parsedRoute);
85 85
         $parsedRoute['responses'] = $responses;
86
-        $parsedRoute['showresponse'] = ! empty($responses);
86
+        $parsedRoute['showresponse'] = !empty($responses);
87 87
 
88 88
         return $parsedRoute;
89 89
     }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     {
121 121
         $responses = $this->iterateThroughStrategies('responses', $context, [$route, $controller, $method, $rulesToApply]);
122 122
         if (count($responses)) {
123
-            return array_filter($responses, function ($response) {
123
+            return array_filter($responses, function($response) {
124 124
                 return $response['content'] != null;
125 125
             });
126 126
         }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             $strategyArgs = $arguments;
171 171
             $strategyArgs[] = $context;
172 172
             $results = $strategy(...$strategyArgs);
173
-            if (! is_null($results)) {
173
+            if (!is_null($results)) {
174 174
                 foreach ($results as $index => $item) {
175 175
                     if ($stage == 'responses') {
176 176
                         // Responses are additive
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
                     // and also allows values to be overwritten
183 183
 
184 184
                     // Don't allow overwriting if an empty value is trying to replace a set one
185
-                    if (! in_array($context[$stage], [null, ''], true) && in_array($item, [null, ''], true)) {
185
+                    if (!in_array($context[$stage], [null, ''], true) && in_array($item, [null, ''], true)) {
186 186
                         continue;
187 187
                     } else {
188 188
                         $context[$stage][$index] = $item;
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
         $values = [];
208 208
 
209 209
         // Remove params which have no examples.
210
-        $params = array_filter($params, function ($details) {
211
-            return ! is_null($details['value']);
210
+        $params = array_filter($params, function($details) {
211
+            return !is_null($details['value']);
212 212
         });
213 213
 
214 214
         foreach ($params as $paramName => $details) {
@@ -239,6 +239,6 @@  discard block
 block discarded – undo
239 239
             $paramName = str_replace(['][', '[', ']', '..'], ['.', '.', '', '.*.'], $paramName);
240 240
         }
241 241
         // Then generate a sample item for the dot notation
242
-        Arr::set($values, str_replace(['.*', '*.'], ['.0','0.'], $paramName), $paramExample);
242
+        Arr::set($values, str_replace(['.*', '*.'], ['.0', '0.'], $paramName), $paramExample);
243 243
     }
244 244
 }
Please login to merge, or discard this patch.
Backup/src/Extracting/Strategies/Responses/UseResponseTag.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     protected function getDocBlockResponses(array $tags)
44 44
     {
45 45
         $responseTags = array_values(
46
-            array_filter($tags, function ($tag) {
46
+            array_filter($tags, function($tag) {
47 47
                 return $tag instanceof Tag && strtolower($tag->getName()) === 'response';
48 48
             })
49 49
         );
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             return null;
53 53
         }
54 54
 
55
-        $responses = array_map(function (Tag $responseTag) {
55
+        $responses = array_map(function(Tag $responseTag) {
56 56
             preg_match('/^(\d{3})?\s?([\s\S]*)$/', $responseTag->getContent(), $result);
57 57
 
58 58
             $status = $result[1] ?: 200;
Please login to merge, or discard this patch.
Backup/src/Extracting/Strategies/Responses/ResponseCalls.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function __invoke(Route $route, \ReflectionClass $controller, \ReflectionMethod $method, array $routeRules, array $context = [])
32 32
     {
33 33
         $rulesToApply = $routeRules['response_calls'] ?? [];
34
-        if (! $this->shouldMakeApiCall($route, $rulesToApply, $context)) {
34
+        if (!$this->shouldMakeApiCall($route, $rulesToApply, $context)) {
35 35
             return null;
36 36
         }
37 37
 
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
         // set URL and query parameters
195 195
         $uri = $request->getRequestUri();
196 196
         $query = $request->getQueryString();
197
-        if (! empty($query)) {
197
+        if (!empty($query)) {
198 198
             $uri .= "?$query";
199 199
         }
200 200
         $response = call_user_func_array([$dispatcher, strtolower($request->method())], [$uri]);
201 201
 
202 202
         // the response from the Dingo dispatcher is the 'raw' response from the controller,
203 203
         // so we have to ensure it's JSON first
204
-        if (! $response instanceof Response) {
204
+        if (!$response instanceof Response) {
205 205
             $response = response()->json($response);
206 206
         }
207 207
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         }
330 330
 
331 331
         // Don't attempt a response call if there are already successful responses
332
-        $successResponses = collect($context['responses'])->filter(function ($response) {
332
+        $successResponses = collect($context['responses'])->filter(function($response) {
333 333
             return ((string) $response['status'])[0] == '2';
334 334
         })->count();
335 335
         if ($successResponses) {
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
         $prefix = 'HTTP_';
366 366
         foreach ($headers as $name => $value) {
367 367
             $name = strtr(strtoupper($name), '-', '_');
368
-            if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
368
+            if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
369 369
                 $name = $prefix . $name;
370 370
             }
371 371
             $server[$name] = $value;
Please login to merge, or discard this patch.
Backup/src/Extracting/Strategies/Responses/UseTransformerTags.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
             $fractal = new Manager();
67 67
 
68
-            if (! is_null(config('apidoc.fractal.serializer'))) {
68
+            if (!is_null(config('apidoc.fractal.serializer'))) {
69 69
                 $fractal->setSerializer(app(config('apidoc.fractal.serializer')));
70 70
             }
71 71
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     private function getClassToBeTransformed(array $tags, ReflectionMethod $transformerMethod): string
123 123
     {
124
-        $modelTag = Arr::first(array_filter($tags, function ($tag) {
124
+        $modelTag = Arr::first(array_filter($tags, function($tag) {
125 125
             return ($tag instanceof Tag) && strtolower($tag->getName()) == 'transformermodel';
126 126
         }));
127 127
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             $type = $modelTag->getContent();
131 131
         } else {
132 132
             $parameter = Arr::first($transformerMethod->getParameters());
133
-            if ($parameter->hasType() && ! $parameter->getType()->isBuiltin() && class_exists($parameter->getType()->getName())) {
133
+            if ($parameter->hasType() && !$parameter->getType()->isBuiltin() && class_exists($parameter->getType()->getName())) {
134 134
                 // Ladies and gentlemen, we have a type!
135 135
                 $type = $parameter->getType()->getName();
136 136
             }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     private function getTransformerTag(array $tags)
192 192
     {
193 193
         $transformerTags = array_values(
194
-            array_filter($tags, function ($tag) {
194
+            array_filter($tags, function($tag) {
195 195
                 return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['transformer', 'transformercollection']);
196 196
             })
197 197
         );
Please login to merge, or discard this patch.
Backup/src/Extracting/Strategies/Responses/UseApiResourceTags.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     private function getClassToBeTransformed(array $tags): string
125 125
     {
126
-        $modelTag = Arr::first(array_filter($tags, function ($tag) {
126
+        $modelTag = Arr::first(array_filter($tags, function($tag) {
127 127
             return ($tag instanceof Tag) && strtolower($tag->getName()) == 'apiresourcemodel';
128 128
         }));
129 129
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     private function getApiResourceTag(array $tags)
185 185
     {
186 186
         $apiResourceTags = array_values(
187
-            array_filter($tags, function ($tag) {
187
+            array_filter($tags, function($tag) {
188 188
                 return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['apiresource', 'apiresourcecollection']);
189 189
             })
190 190
         );
Please login to merge, or discard this patch.