Completed
Pull Request — master (#376)
by
unknown
01:48
created
src/Generators/LaravelGenerator.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,6 @@
 block discarded – undo
41 41
     /**
42 42
      * Prepares / Disables route middlewares.
43 43
      *
44
-     * @param  bool $disable
45 44
      *
46 45
      * @return  void
47 46
      */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
      */
58 58
     public function prepareMiddleware($enable = true)
59 59
     {
60
-        App::instance('middleware.disable', ! $enable);
60
+        App::instance('middleware.disable', !$enable);
61 61
     }
62 62
 
63 63
     /**
Please login to merge, or discard this patch.
src/Generators/DingoGenerator.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     {
26 26
         $dispatcher = app('Dingo\Api\Dispatcher')->raw();
27 27
 
28
-        collect($server)->map(function ($key, $value) use ($dispatcher) {
28
+        collect($server)->map(function($key, $value) use ($dispatcher) {
29 29
             $dispatcher->header($value, $key);
30 30
         });
31 31
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
      *
47 47
      * @param  bool $disable
48 48
      *
49
-     * @return  void
49
+     * @return  boolean
50 50
      */
51 51
     public function prepareMiddleware($disable = true)
52 52
     {
Please login to merge, or discard this patch.
src/Postman/CollectionWriter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
                 'description' => '',
33 33
                 'schema' => 'https://schema.getpostman.com/json/collection/v2.0.0/collection.json',
34 34
             ],
35
-            'item' => $this->routeGroups->map(function ($routes, $groupName) {
35
+            'item' => $this->routeGroups->map(function($routes, $groupName) {
36 36
                 return [
37 37
                     'name' => $groupName,
38 38
                     'description' => '',
39
-                    'item' => $routes->map(function ($route) {
39
+                    'item' => $routes->map(function($route) {
40 40
                         return [
41 41
                             'name' => $route['title'] != '' ? $route['title'] : url($route['uri']),
42 42
                             'request' => [
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
                                 'method' => $route['methods'][0],
45 45
                                 'body' => [
46 46
                                     'mode' => 'formdata',
47
-                                    'formdata' => collect($route['parameters'])->map(function ($parameter, $key) {
47
+                                    'formdata' => collect($route['parameters'])->map(function($parameter, $key) {
48 48
                                         return [
49 49
                                             'key' => $key,
50 50
                                             'value' => isset($parameter['value']) ? $parameter['value'] : '',
Please login to merge, or discard this patch.
src/Tools/RouteMatcher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 
49 49
     private function getAllRoutes(bool $usingDingoRouter, array $versions = [])
50 50
     {
51
-        if (! $usingDingoRouter) {
51
+        if (!$usingDingoRouter) {
52 52
             return RouteFacade::getRoutes();
53 53
         }
54 54
 
55 55
         $allRouteCollections = app(\Dingo\Api\Routing\Router::class)->getRoutes();
56 56
 
57 57
         return collect($allRouteCollections)
58
-            ->flatMap(function (RouteCollection $collection) {
58
+            ->flatMap(function(RouteCollection $collection) {
59 59
                 return $collection->getRoutes();
60 60
             })->toArray();
61 61
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     private function shouldIncludeRoute(Route $route, array $routeRule, array $mustIncludes, bool $usingDingoRouter)
64 64
     {
65 65
         $matchesVersion = $usingDingoRouter
66
-            ? ! empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? []))
66
+            ? !empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? []))
67 67
             : true;
68 68
 
69 69
         return in_array($route->getName(), $mustIncludes)
Please login to merge, or discard this patch.
src/ApiDocGeneratorServiceProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,17 +15,17 @@
 block discarded – undo
15 15
      */
16 16
     public function boot()
17 17
     {
18
-        $this->loadViewsFrom(__DIR__.'/../resources/views/', 'apidoc');
18
+        $this->loadViewsFrom(__DIR__ . '/../resources/views/', 'apidoc');
19 19
 
20 20
         $this->publishes([
21
-            __DIR__.'/../resources/views' => app()->basePath().'/resources/views/vendor/apidoc',
21
+            __DIR__ . '/../resources/views' => app()->basePath() . '/resources/views/vendor/apidoc',
22 22
         ], 'views');
23 23
 
24 24
         $this->publishes([
25
-            __DIR__.'/../config/apidoc.php' => config_path('apidoc.php'),
25
+            __DIR__ . '/../config/apidoc.php' => config_path('apidoc.php'),
26 26
         ], 'config');
27 27
 
28
-        $this->mergeConfigFrom(__DIR__.'/../config/apidoc.php', 'apidoc');
28
+        $this->mergeConfigFrom(__DIR__ . '/../config/apidoc.php', 'apidoc');
29 29
 
30 30
         if ($this->app->runningInConsole()) {
31 31
             $this->commands([
Please login to merge, or discard this patch.
src/Commands/UpdateDocumentation.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,15 +42,15 @@
 block discarded – undo
42 42
 
43 43
         $documentarian = new Documentarian();
44 44
 
45
-        if (! is_dir($outputPath)) {
46
-            $this->error('There is no existing documentation available at '.$outputPath.'.');
45
+        if (!is_dir($outputPath)) {
46
+            $this->error('There is no existing documentation available at ' . $outputPath . '.');
47 47
 
48 48
             return false;
49 49
         }
50
-        $this->info('Rebuilding API HTML code from '.$outputPath.'/source/index.md');
50
+        $this->info('Rebuilding API HTML code from ' . $outputPath . '/source/index.md');
51 51
 
52 52
         $documentarian->generate($outputPath);
53 53
 
54
-        $this->info('Wrote HTML documentation to: '.$outputPath.'/index.html');
54
+        $this->info('Wrote HTML documentation to: ' . $outputPath . '/index.html');
55 55
     }
56 56
 }
Please login to merge, or discard this patch.
src/Generators/AbstractGenerator.php 2 patches
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     /**
26 26
      * @param Route $route
27 27
      *
28
-     * @return mixed
28
+     * @return string
29 29
      */
30 30
     public function getUri(Route $route)
31 31
     {
@@ -44,7 +44,6 @@  discard block
 block discarded – undo
44 44
 
45 45
     /**
46 46
      * @param  \Illuminate\Routing\Route $route
47
-     * @param array $apply Rules to apply when generating documentation for this route
48 47
      *
49 48
      * @return array
50 49
      */
@@ -79,7 +78,6 @@  discard block
 block discarded – undo
79 78
     /**
80 79
      * Prepares / Disables route middlewares.
81 80
      *
82
-     * @param  bool $disable
83 81
      *
84 82
      * @return  void
85 83
      */
@@ -187,6 +185,9 @@  discard block
 block discarded – undo
187 185
         return 'general';
188 186
     }
189 187
 
188
+    /**
189
+     * @return string
190
+     */
190 191
     private function normalizeParameterType($type)
191 192
     {
192 193
         $typeMap = [
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $content = ResponseResolver::getResponse($route, $docBlock['tags'], $rulesToApply);
61 61
 
62 62
         $parsedRoute = [
63
-            'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))),
63
+            'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))),
64 64
             'group' => $routeGroup,
65 65
             'title' => $docBlock['short'],
66 66
             'description' => $docBlock['long'],
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             'parameters' => $this->getParametersFromDocBlock($docBlock['tags']),
70 70
             'authenticated' => $this->getAuthStatusFromDocBlock($docBlock['tags']),
71 71
             'response' => $content,
72
-            'showresponse' => ! empty($content),
72
+            'showresponse' => !empty($content),
73 73
         ];
74 74
         $parsedRoute['headers'] = $rulesToApply['headers'] ?? [];
75 75
 
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
     protected function getParametersFromDocBlock(array $tags)
94 94
     {
95 95
         $parameters = collect($tags)
96
-            ->filter(function ($tag) {
96
+            ->filter(function($tag) {
97 97
                 return $tag instanceof Tag && $tag->getName() === 'bodyParam';
98 98
             })
99
-            ->mapWithKeys(function ($tag) {
99
+            ->mapWithKeys(function($tag) {
100 100
                 preg_match('/(.+?)\s+(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content);
101 101
                 if (empty($content)) {
102 102
                     // this means only name and type were supplied
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     protected function getAuthStatusFromDocBlock(array $tags)
131 131
     {
132 132
         $authTag = collect($tags)
133
-            ->first(function ($tag) {
133
+            ->first(function($tag) {
134 134
                 return $tag instanceof Tag && strtolower($tag->getName()) === 'authenticated';
135 135
             });
136 136
 
@@ -202,25 +202,25 @@  discard block
 block discarded – undo
202 202
     {
203 203
         $faker = Factory::create();
204 204
         $fakes = [
205
-            'integer' => function () {
205
+            'integer' => function() {
206 206
                 return rand(1, 20);
207 207
             },
208
-            'number' => function () use ($faker) {
208
+            'number' => function() use ($faker) {
209 209
                 return $faker->randomFloat();
210 210
             },
211
-            'float' => function () use ($faker) {
211
+            'float' => function() use ($faker) {
212 212
                 return $faker->randomFloat();
213 213
             },
214
-            'boolean' => function () use ($faker) {
214
+            'boolean' => function() use ($faker) {
215 215
                 return $faker->boolean();
216 216
             },
217
-            'string' => function () use ($faker) {
217
+            'string' => function() use ($faker) {
218 218
                 return str_random();
219 219
             },
220
-            'array' => function () {
220
+            'array' => function() {
221 221
                 return '[]';
222 222
             },
223
-            'object' => function () {
223
+            'object' => function() {
224 224
                 return '{}';
225 225
             },
226 226
         ];
Please login to merge, or discard this patch.
src/Tools/ResponseResolver.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -37,6 +37,9 @@
 block discarded – undo
37 37
         }
38 38
     }
39 39
 
40
+    /**
41
+     * @param Route $route
42
+     */
40 43
     public static function getResponse($route, $tags, $rulesToApply)
41 44
     {
42 45
         return (new static($route))->resolve($tags, $rulesToApply);
Please login to merge, or discard this patch.
src/Tools/ResponseStrategies/ResponseCallStrategy.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @param Route $route
59 59
      * @param array $bindings
60 60
      *
61
-     * @return mixed
61
+     * @return string
62 62
      */
63 63
     protected function replaceUrlParameterBindings(Route $route, $bindings)
64 64
     {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     }
190 190
 
191 191
     /**
192
-     * @param $request
192
+     * @param Request $request
193 193
      *
194 194
      * @return \Symfony\Component\HttpFoundation\Response
195 195
      */
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     public function __invoke(Route $route, array $tags, array $rulesToApply)
16 16
     {
17 17
         $rulesToApply = $rulesToApply['response_calls'] ?? [];
18
-        if (! $this->shouldMakeApiCall($route, $rulesToApply)) {
18
+        if (!$this->shouldMakeApiCall($route, $rulesToApply)) {
19 19
             return;
20 20
         }
21 21
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
         // the response from the Dingo dispatcher is the 'raw' response from the controller,
133 133
         // so we have to ensure it's JSON first
134
-        if (! $response instanceof Response) {
134
+        if (!$response instanceof Response) {
135 135
             $response = response()->json($response);
136 136
         }
137 137
 
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
         $prefix = 'HTTP_';
235 235
         foreach ($headers as $name => $value) {
236 236
             $name = strtr(strtoupper($name), '-', '_');
237
-            if (! starts_with($name, $prefix) && $name !== 'CONTENT_TYPE') {
238
-                $name = $prefix.$name;
237
+            if (!starts_with($name, $prefix) && $name !== 'CONTENT_TYPE') {
238
+                $name = $prefix . $name;
239 239
             }
240 240
             $server[$name] = $value;
241 241
         }
Please login to merge, or discard this patch.