Completed
Push — master ( 96f998...92226e )
by
unknown
24s
created
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/Tools/ResponseResolver.php 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
         foreach (static::$strategies as $strategy) {
32 32
             $strategy = new $strategy();
33 33
             $response = $strategy($this->route, $tags, $rulesToApply);
34
-            if (! is_null($response)) {
34
+            if (!is_null($response)) {
35 35
                 return $this->getResponseContent($response);
36 36
             }
37 37
         }
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   +5 added lines, -5 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
 
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
         // set URL and query parameters
120 120
         $uri = $request->getRequestUri();
121 121
         $query = $request->getQueryString();
122
-        if (! empty($query)) {
122
+        if (!empty($query)) {
123 123
             $uri .= "?$query";
124 124
         }
125 125
         $response = call_user_func_array([$dispatcher, strtolower($request->method())], [$uri]);
126 126
 
127 127
         // the response from the Dingo dispatcher is the 'raw' response from the controller,
128 128
         // so we have to ensure it's JSON first
129
-        if (! $response instanceof Response) {
129
+        if (!$response instanceof Response) {
130 130
             $response = response()->json($response);
131 131
         }
132 132
 
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
         $prefix = 'HTTP_';
234 234
         foreach ($headers as $name => $value) {
235 235
             $name = strtr(strtoupper($name), '-', '_');
236
-            if (! starts_with($name, $prefix) && $name !== 'CONTENT_TYPE') {
237
-                $name = $prefix.$name;
236
+            if (!starts_with($name, $prefix) && $name !== 'CONTENT_TYPE') {
237
+                $name = $prefix . $name;
238 238
             }
239 239
             $server[$name] = $value;
240 240
         }
Please login to merge, or discard this patch.
src/Tools/ResponseStrategies/ResponseTagStrategy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      */
25 25
     protected function getDocBlockResponse(array $tags)
26 26
     {
27
-        $responseTags = array_filter($tags, function ($tag) {
27
+        $responseTags = array_filter($tags, function($tag) {
28 28
             return $tag instanceof Tag && strtolower($tag->getName()) == 'response';
29 29
         });
30 30
         if (empty($responseTags)) {
Please login to merge, or discard this patch.
src/Generators/Generator.php 2 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     /**
16 16
      * @param Route $route
17 17
      *
18
-     * @return mixed
18
+     * @return string
19 19
      */
20 20
     public function getUri(Route $route)
21 21
     {
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
 
35 35
     /**
36 36
      * @param  \Illuminate\Routing\Route $route
37
-     * @param array $apply Rules to apply when generating documentation for this route
38 37
      *
39 38
      * @return array
40 39
      */
@@ -167,6 +166,9 @@  discard block
 block discarded – undo
167 166
         return 'general';
168 167
     }
169 168
 
169
+    /**
170
+     * @return string
171
+     */
170 172
     private function normalizeParameterType($type)
171 173
     {
172 174
         $typeMap = [
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $content = ResponseResolver::getResponse($route, $docBlock['tags'], $rulesToApply);
51 51
 
52 52
         $parsedRoute = [
53
-            'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))),
53
+            'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))),
54 54
             'group' => $routeGroup,
55 55
             'title' => $docBlock['short'],
56 56
             'description' => $docBlock['long'],
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             'queryParameters' => $this->getQueryParametersFromDocBlock($docBlock['tags']),
61 61
             'authenticated' => $this->getAuthStatusFromDocBlock($docBlock['tags']),
62 62
             'response' => $content,
63
-            'showresponse' => ! empty($content),
63
+            'showresponse' => !empty($content),
64 64
         ];
65 65
         $parsedRoute['headers'] = $rulesToApply['headers'] ?? [];
66 66
 
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
     protected function getBodyParametersFromDocBlock(array $tags)
76 76
     {
77 77
         $parameters = collect($tags)
78
-            ->filter(function ($tag) {
78
+            ->filter(function($tag) {
79 79
                 return $tag instanceof Tag && $tag->getName() === 'bodyParam';
80 80
             })
81
-            ->mapWithKeys(function ($tag) {
81
+            ->mapWithKeys(function($tag) {
82 82
                 preg_match('/(.+?)\s+(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content);
83 83
                 if (empty($content)) {
84 84
                     // this means only name and type were supplied
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
     protected function getQueryParametersFromDocBlock(array $tags)
113 113
     {
114 114
         $parameters = collect($tags)
115
-            ->filter(function ($tag) {
115
+            ->filter(function($tag) {
116 116
                 return $tag instanceof Tag && $tag->getName() === 'queryParam';
117 117
             })
118
-            ->mapWithKeys(function ($tag) {
118
+            ->mapWithKeys(function($tag) {
119 119
                 preg_match('/(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content);
120 120
                 if (empty($content)) {
121 121
                     // this means only name was supplied
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     protected function getAuthStatusFromDocBlock(array $tags)
147 147
     {
148 148
         $authTag = collect($tags)
149
-            ->first(function ($tag) {
149
+            ->first(function($tag) {
150 150
                 return $tag instanceof Tag && strtolower($tag->getName()) === 'authenticated';
151 151
             });
152 152
 
@@ -217,25 +217,25 @@  discard block
 block discarded – undo
217 217
     {
218 218
         $faker = Factory::create();
219 219
         $fakes = [
220
-            'integer' => function () {
220
+            'integer' => function() {
221 221
                 return rand(1, 20);
222 222
             },
223
-            'number' => function () use ($faker) {
223
+            'number' => function() use ($faker) {
224 224
                 return $faker->randomFloat();
225 225
             },
226
-            'float' => function () use ($faker) {
226
+            'float' => function() use ($faker) {
227 227
                 return $faker->randomFloat();
228 228
             },
229
-            'boolean' => function () use ($faker) {
229
+            'boolean' => function() use ($faker) {
230 230
                 return $faker->boolean();
231 231
             },
232
-            'string' => function () use ($faker) {
232
+            'string' => function() use ($faker) {
233 233
                 return str_random();
234 234
             },
235
-            'array' => function () {
235
+            'array' => function() {
236 236
                 return '[]';
237 237
             },
238
-            'object' => function () {
238
+            'object' => function() {
239 239
                 return '{}';
240 240
             },
241 241
         ];
Please login to merge, or discard this patch.
src/Tools/ResponseStrategies/TransformerTagsStrategy.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     private function getClassToBeTransformed(array $tags, ReflectionMethod $transformerMethod)
69 69
     {
70
-        $modelTag = array_first(array_filter($tags, function ($tag) {
70
+        $modelTag = array_first(array_filter($tags, function($tag) {
71 71
             return ($tag instanceof Tag) && strtolower($tag->getName()) == 'transformermodel';
72 72
         }));
73 73
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             $type = $modelTag->getContent();
77 77
         } else {
78 78
             $parameter = array_first($transformerMethod->getParameters());
79
-            if ($parameter->hasType() && ! $parameter->getType()->isBuiltin() && class_exists((string) $parameter->getType())) {
79
+            if ($parameter->hasType() && !$parameter->getType()->isBuiltin() && class_exists((string) $parameter->getType())) {
80 80
                 // ladies and gentlemen, we have a type!
81 81
                 $type = (string) $parameter->getType();
82 82
             }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     private function getTransformerTag(array $tags)
122 122
     {
123
-        $transFormerTags = array_filter($tags, function ($tag) {
123
+        $transFormerTags = array_filter($tags, function($tag) {
124 124
             return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['transformer', 'transformercollection']);
125 125
         });
126 126
 
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['bodyParameters'])->map(function ($parameter, $key) {
47
+                                    'formdata' => collect($route['bodyParameters'])->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.