Completed
Push — master ( 2ebe64...c5c478 )
by
unknown
08:06 queued 06:18
created
src/Generators/LaravelGenerator.php 1 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/AbstractGenerator.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             $response = $docblockResponse;
64 64
             $showresponse = true;
65 65
         }
66
-        if (! $response) {
66
+        if (!$response) {
67 67
             $transformerResponse = $this->getTransformerResponse($routeDescription['tags']);
68 68
             if ($transformerResponse) {
69 69
                 // we have a transformer response from the docblock ( @transformer || @transformercollection )
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $content = $this->getResponseContent($response);
76 76
 
77 77
         return [
78
-            'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))),
78
+            'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))),
79 79
             'resource' => $routeGroup,
80 80
             'title' => $routeDescription['short'],
81 81
             'description' => $routeDescription['long'],
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
      */
106 106
     protected function getDocblockResponse($tags)
107 107
     {
108
-        $responseTags = array_filter($tags, function ($tag) {
109
-            if (! ($tag instanceof Tag)) {
108
+        $responseTags = array_filter($tags, function($tag) {
109
+            if (!($tag instanceof Tag)) {
110 110
                 return false;
111 111
             }
112 112
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         $methods = $this->getMethods($route);
144 144
 
145 145
         // Split headers into key - value pairs
146
-        $headers = collect($headers)->map(function ($value) {
146
+        $headers = collect($headers)->map(function($value) {
147 147
             $split = explode(':', $value); // explode to get key + values
148 148
             $key = array_shift($split); // extract the key and keep the values in the array
149 149
             $value = implode(':', $split); // implode values into string again
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
     {
168 168
         $uri = $this->getUri($route);
169 169
         foreach ($bindings as $model => $id) {
170
-            $uri = str_replace('{'.$model.'}', $id, $uri);
171
-            $uri = str_replace('{'.$model.'?}', $id, $uri);
170
+            $uri = str_replace('{' . $model . '}', $id, $uri);
171
+            $uri = str_replace('{' . $model . '?}', $id, $uri);
172 172
         }
173 173
 
174 174
         return $uri;
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
         foreach ($headers as $name => $value) {
248 248
             $name = strtr(strtoupper($name), '-', '_');
249 249
 
250
-            if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
251
-                $name = $prefix.$name;
250
+            if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
251
+                $name = $prefix . $name;
252 252
             }
253 253
 
254 254
             $server[$name] = $value;
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
     protected function getTransformerResponse($tags)
287 287
     {
288 288
         try {
289
-            $transFormerTags = array_filter($tags, function ($tag) {
290
-                if (! ($tag instanceof Tag)) {
289
+            $transFormerTags = array_filter($tags, function($tag) {
290
+                if (!($tag instanceof Tag)) {
291 291
                     return false;
292 292
                 }
293 293
 
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
                 return false;
299 299
             }
300 300
 
301
-            $modelTag = array_first(array_filter($tags, function ($tag) {
302
-                if (! ($tag instanceof Tag)) {
301
+            $modelTag = array_first(array_filter($tags, function($tag) {
302
+                if (!($tag instanceof Tag)) {
303 303
                     return false;
304 304
                 }
305 305
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
             }));
308 308
             $tag = \array_first($transFormerTags);
309 309
             $transformer = $tag->getContent();
310
-            if (! \class_exists($transformer)) {
310
+            if (!\class_exists($transformer)) {
311 311
                 // if we can't find the transformer we can't generate a response
312 312
                 return;
313 313
             }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
             if (version_compare(PHP_VERSION, '7.0.0') >= 0 && \is_null($type)) {
324 324
                 // we can only get the type with reflection for PHP 7
325 325
                 if ($parameter->hasType() &&
326
-                    ! $parameter->getType()->isBuiltin() &&
326
+                    !$parameter->getType()->isBuiltin() &&
327 327
                     \class_exists((string) $parameter->getType())) {
328 328
                     //we have a type
329 329
                     $type = (string) $parameter->getType();
Please login to merge, or discard this patch.
src/Generators/DingoGenerator.php 1 patch
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.
src/ApiDocGeneratorServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@
 block discarded – undo
18 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 28
         if ($this->app->runningInConsole()) {
Please login to merge, or discard this patch.
src/Tools/RouteMatcher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 {
11 11
     public function getDingoRoutesToBeDocumented(array $routeRules)
12 12
     {
13
-        return $this->getRoutesToBeDocumented($routeRules,true);
13
+        return $this->getRoutesToBeDocumented($routeRules, true);
14 14
     }
15 15
 
16 16
     public function getLaravelRoutesToBeDocumented(array $routeRules)
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
         $allRouteCollections = app(\Dingo\Api\Routing\Router::class)->getRoutes();
56 56
         return collect($allRouteCollections)
57
-            ->flatMap(function (RouteCollection $collection) {
57
+            ->flatMap(function(RouteCollection $collection) {
58 58
                 return $collection->getRoutes();
59 59
             })->toArray();
60 60
     }
Please login to merge, or discard this patch.
src/Commands/GenerateDocumentation.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
         $parsedRoutes = $this->processRoutes($generator, $routes);
63 63
         $parsedRoutes = collect($parsedRoutes)->groupBy('resource')
64
-            ->sort(function ($a, $b) {
64
+            ->sort(function($a, $b) {
65 65
                 return strcmp($a->first()['resource'], $b->first()['resource']);
66 66
         });
67 67
 
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
     private function writeMarkdown($parsedRoutes)
77 77
     {
78 78
         $outputPath = $this->option('output');
79
-        $targetFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'index.md';
80
-        $compareFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'.compare.md';
81
-        $prependFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'prepend.md';
82
-        $appendFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'append.md';
79
+        $targetFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'index.md';
80
+        $compareFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . '.compare.md';
81
+        $prependFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'prepend.md';
82
+        $appendFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'append.md';
83 83
 
84 84
         $infoText = view('apidoc::partials.info')
85 85
             ->with('outputPath', ltrim($outputPath, 'public/'))
86
-            ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection'));
86
+            ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection'));
87 87
 
88
-        $parsedRouteOutput = $parsedRoutes->map(function ($routeGroup) {
89
-            return $routeGroup->map(function ($route) {
88
+        $parsedRouteOutput = $parsedRoutes->map(function($routeGroup) {
89
+            return $routeGroup->map(function($route) {
90 90
                 $route['output'] = (string) view('apidoc::partials.route')->with('parsedRoute', $route)->render();
91 91
 
92 92
                 return $route;
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
                 $frontmatter = trim($generatedFrontmatter[1], "\n");
107 107
             }
108 108
 
109
-            $parsedRouteOutput->transform(function ($routeGroup) use ($generatedDocumentation, $compareDocumentation) {
110
-                return $routeGroup->transform(function ($route) use ($generatedDocumentation, $compareDocumentation) {
111
-                    if (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $generatedDocumentation, $routeMatch)) {
112
-                        $routeDocumentationChanged = (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $compareDocumentation, $compareMatch) && $compareMatch[1] !== $routeMatch[1]);
109
+            $parsedRouteOutput->transform(function($routeGroup) use ($generatedDocumentation, $compareDocumentation) {
110
+                return $routeGroup->transform(function($route) use ($generatedDocumentation, $compareDocumentation) {
111
+                    if (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $generatedDocumentation, $routeMatch)) {
112
+                        $routeDocumentationChanged = (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $compareDocumentation, $compareMatch) && $compareMatch[1] !== $routeMatch[1]);
113 113
                         if ($routeDocumentationChanged === false || $this->option('force')) {
114 114
                             if ($routeDocumentationChanged) {
115
-                                $this->warn('Discarded manual changes for route ['.implode(',', $route['methods']).'] '.$route['uri']);
115
+                                $this->warn('Discarded manual changes for route [' . implode(',', $route['methods']) . '] ' . $route['uri']);
116 116
                             }
117 117
                         } else {
118
-                            $this->warn('Skipping modified route ['.implode(',', $route['methods']).'] '.$route['uri']);
118
+                            $this->warn('Skipping modified route [' . implode(',', $route['methods']) . '] ' . $route['uri']);
119 119
                             $route['modified_output'] = $routeMatch[0];
120 120
                         }
121 121
                     }
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
         }
127 127
 
128 128
         $prependFileContents = file_exists($prependFile)
129
-            ? file_get_contents($prependFile)."\n" : '';
129
+            ? file_get_contents($prependFile) . "\n" : '';
130 130
         $appendFileContents = file_exists($appendFile)
131
-            ? "\n".file_get_contents($appendFile) : '';
131
+            ? "\n" . file_get_contents($appendFile) : '';
132 132
 
133 133
         $documentarian = new Documentarian();
134 134
 
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
             ->with('prependMd', $prependFileContents)
140 140
             ->with('appendMd', $appendFileContents)
141 141
             ->with('outputPath', $this->option('output'))
142
-            ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection'))
142
+            ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection'))
143 143
             ->with('parsedRoutes', $parsedRouteOutput);
144 144
 
145
-        if (! is_dir($outputPath)) {
145
+        if (!is_dir($outputPath)) {
146 146
             $documentarian->create($outputPath);
147 147
         }
148 148
 
@@ -157,23 +157,23 @@  discard block
 block discarded – undo
157 157
             ->with('prependMd', $prependFileContents)
158 158
             ->with('appendMd', $appendFileContents)
159 159
             ->with('outputPath', $this->option('output'))
160
-            ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection'))
160
+            ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection'))
161 161
             ->with('parsedRoutes', $parsedRouteOutput);
162 162
 
163 163
         file_put_contents($compareFile, $compareMarkdown);
164 164
 
165
-        $this->info('Wrote index.md to: '.$outputPath);
165
+        $this->info('Wrote index.md to: ' . $outputPath);
166 166
 
167 167
         $this->info('Generating API HTML code');
168 168
 
169 169
         $documentarian->generate($outputPath);
170 170
 
171
-        $this->info('Wrote HTML documentation to: '.$outputPath.'/index.html');
171
+        $this->info('Wrote HTML documentation to: ' . $outputPath . '/index.html');
172 172
 
173 173
         if ($this->option('noPostmanCollection') !== true) {
174 174
             $this->info('Generating Postman collection');
175 175
 
176
-            file_put_contents($outputPath.DIRECTORY_SEPARATOR.'collection.json', $this->generatePostmanCollection($parsedRoutes));
176
+            file_put_contents($outputPath . DIRECTORY_SEPARATOR . 'collection.json', $this->generatePostmanCollection($parsedRoutes));
177 177
         }
178 178
     }
179 179
 
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
             /** @var Route $route */
192 192
                 if ($this->isValidRoute($route) && $this->isRouteVisibleForDocumentation($route->getAction()['uses'])) {
193 193
                     $parsedRoutes[] = $generator->processRoute($route, $apply);
194
-                    $this->info('Processed route: ['.implode(',', $generator->getMethods($route)).'] '.$generator->getUri($route));
194
+                    $this->info('Processed route: [' . implode(',', $generator->getMethods($route)) . '] ' . $generator->getUri($route));
195 195
                 } else {
196
-                    $this->warn('Skipping route: ['.implode(',', $generator->getMethods($route)).'] '.$generator->getUri($route));
196
+                    $this->warn('Skipping route: [' . implode(',', $generator->getMethods($route)) . '] ' . $generator->getUri($route));
197 197
                 }
198 198
         }
199 199
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      */
208 208
     private function isValidRoute(Route $route)
209 209
     {
210
-        return ! is_callable($route->getAction()['uses']) && ! is_null($route->getAction()['uses']);
210
+        return !is_callable($route->getAction()['uses']) && !is_null($route->getAction()['uses']);
211 211
     }
212 212
 
213 213
     /**
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
             $phpdoc = new DocBlock($comment);
225 225
 
226 226
             return collect($phpdoc->getTags())
227
-                ->filter(function ($tag) use ($route) {
227
+                ->filter(function($tag) use ($route) {
228 228
                     return $tag->getName() === 'hideFromAPIDocumentation';
229 229
                 })
230 230
                 ->isEmpty();
Please login to merge, or discard this patch.
src/Commands/UpdateDocumentation.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 
45 45
         $documentarian = new Documentarian();
46 46
 
47
-        if (! is_dir($outputPath)) {
48
-            $this->error('There is no generated documentation available at '.$outputPath.'.');
47
+        if (!is_dir($outputPath)) {
48
+            $this->error('There is no generated documentation available at ' . $outputPath . '.');
49 49
 
50 50
             return false;
51 51
         }
@@ -53,6 +53,6 @@  discard block
 block discarded – undo
53 53
 
54 54
         $documentarian->generate($outputPath);
55 55
 
56
-        $this->info('Wrote HTML documentation to: '.$outputPath.'/index.html');
56
+        $this->info('Wrote HTML documentation to: ' . $outputPath . '/index.html');
57 57
     }
58 58
 }
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.