Completed
Push — master ( b12ac9...aa4f63 )
by Marcel
05:40
created
src/Mpociot/ApiDoc/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.'/public/index.html');
56
+        $this->info('Wrote HTML documentation to: ' . $outputPath . '/public/index.html');
57 57
     }
58 58
 }
Please login to merge, or discard this patch.
src/Mpociot/ApiDoc/Parsers/RuleDescriptionParser.php 1 patch
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@  discard block
 block discarded – undo
34 34
     public function with($parameters)
35 35
     {
36 36
         is_array($parameters) ?
37
-            $this->parameters += $parameters :
38
-            $this->parameters[] = $parameters;
37
+            $this->parameters += $parameters : $this->parameters[] = $parameters;
39 38
 
40 39
         return $this;
41 40
     }
@@ -54,8 +53,7 @@  discard block
 block discarded – undo
54 53
     protected function makeDescription()
55 54
     {
56 55
         $description = trans()->hasForLocale($this->rule) ?
57
-                            trans()->get($this->rule) :
58
-                            trans()->get($this->rule, [], self::DEFAULT_LOCALE);
56
+                            trans()->get($this->rule) : trans()->get($this->rule, [], self::DEFAULT_LOCALE);
59 57
 
60 58
         return $this->replaceAttributes($description);
61 59
     }
Please login to merge, or discard this patch.
src/Mpociot/ApiDoc/Postman/CollectionWriter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
                 'description' => '',
32 32
                 'schema' => 'https://schema.getpostman.com/json/collection/v2.0.0/collection.json'
33 33
             ],
34
-            'item' => $this->routeGroups->map(function ($routes, $groupName) {
34
+            'item' => $this->routeGroups->map(function($routes, $groupName) {
35 35
                 return [
36 36
                     'name' => $groupName,
37 37
                     'description' => '',
38
-                    'item' => $routes->map(function ($route) {
38
+                    'item' => $routes->map(function($route) {
39 39
                         return [
40 40
                             'name' => $route['title'] != '' ? $route['title'] : url($route['uri']),
41 41
                             'request' => [
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
                                 'method' => $route['methods'][0],
44 44
                                 'body' => [
45 45
                                     'mode' => 'formdata',
46
-                                    'formdata' => collect($route['parameters'])->map(function ($parameter, $key) {
46
+                                    'formdata' => collect($route['parameters'])->map(function($parameter, $key) {
47 47
                                         return [
48 48
                                             'key' => $key,
49 49
                                             'value' => isset($parameter['value']) ? $parameter['value'] : '',
Please login to merge, or discard this patch.
src/Mpociot/ApiDoc/Generators/DingoGenerator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
         $routeDescription = $this->getRouteDescription($routeAction['uses']);
30 30
 
31 31
         return $this->getParameters([
32
-            'id' => md5($route->uri().':'.implode($route->getMethods())),
32
+            'id' => md5($route->uri() . ':' . implode($route->getMethods())),
33 33
             'resource' => $routeGroup,
34 34
             'title' => $routeDescription['short'],
35 35
             'description' => $routeDescription['long'],
Please login to merge, or discard this patch.
src/Mpociot/ApiDoc/Generators/LaravelGenerator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
         }
45 45
 
46 46
         return $this->getParameters([
47
-            'id' => md5($route->getUri().':'.implode($route->getMethods())),
47
+            'id' => md5($route->getUri() . ':' . implode($route->getMethods())),
48 48
             'resource' => $routeGroup,
49 49
             'title' => $routeDescription['short'],
50 50
             'description' => $routeDescription['long'],
Please login to merge, or discard this patch.
src/Mpociot/ApiDoc/Commands/GenerateDocumentation.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         $this->setUserToBeImpersonated($this->option('actAsUserId'));
69 69
 
70
-        if ($routePrefix === null && ! count($allowedRoutes)) {
70
+        if ($routePrefix === null && !count($allowedRoutes)) {
71 71
             $this->error('You must provide either a route prefix or a route to generate the documentation.');
72 72
 
73 73
             return false;
@@ -91,15 +91,15 @@  discard block
 block discarded – undo
91 91
     private function writeMarkdown($parsedRoutes)
92 92
     {
93 93
         $outputPath = $this->option('output');
94
-        $targetFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'index.md';
95
-        $compareFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'.compare.md';
94
+        $targetFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'index.md';
95
+        $compareFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . '.compare.md';
96 96
 
97 97
         $infoText = view('apidoc::partials.info')
98 98
             ->with('outputPath', $this->option('output'))
99
-            ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection'));
99
+            ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection'));
100 100
 
101
-        $parsedRouteOutput = $parsedRoutes->map(function ($routeGroup) {
102
-            return $routeGroup->map(function ($route) {
101
+        $parsedRouteOutput = $parsedRoutes->map(function($routeGroup) {
102
+            return $routeGroup->map(function($route) {
103 103
                 $route['output'] = (string) view('apidoc::partials.route')->with('parsedRoute', $route);
104 104
 
105 105
                 return $route;
@@ -123,16 +123,16 @@  discard block
 block discarded – undo
123 123
                 $frontmatter = trim($generatedFrontmatter[1], "\n");
124 124
             }
125 125
 
126
-            $parsedRouteOutput->transform(function ($routeGroup) use ($generatedDocumentation, $compareDocumentation) {
127
-                return $routeGroup->transform(function ($route) use ($generatedDocumentation, $compareDocumentation) {
128
-                    if (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $generatedDocumentation, $routeMatch)) {
129
-                        $routeDocumentationChanged = (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $compareDocumentation, $compareMatch) && $compareMatch[1] !== $routeMatch[1]);
130
-                        if ($routeDocumentationChanged === false ||  $this->option('force')) {
126
+            $parsedRouteOutput->transform(function($routeGroup) use ($generatedDocumentation, $compareDocumentation) {
127
+                return $routeGroup->transform(function($route) use ($generatedDocumentation, $compareDocumentation) {
128
+                    if (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $generatedDocumentation, $routeMatch)) {
129
+                        $routeDocumentationChanged = (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $compareDocumentation, $compareMatch) && $compareMatch[1] !== $routeMatch[1]);
130
+                        if ($routeDocumentationChanged === false || $this->option('force')) {
131 131
                             if ($routeDocumentationChanged) {
132
-                                $this->warn('Discarded manual changes for route ['.implode(',', $route['methods']).'] '.$route['uri']);
132
+                                $this->warn('Discarded manual changes for route [' . implode(',', $route['methods']) . '] ' . $route['uri']);
133 133
                             }
134 134
                         } else {
135
-                            $this->warn('Skipping modified route ['.implode(',', $route['methods']).'] '.$route['uri']);
135
+                            $this->warn('Skipping modified route [' . implode(',', $route['methods']) . '] ' . $route['uri']);
136 136
                             $route['modified_output'] = $routeMatch[0];
137 137
                         }
138 138
                     }
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
             ->with('frontmatter', $frontmatter)
150 150
             ->with('infoText', $infoText)
151 151
             ->with('outputPath', $this->option('output'))
152
-            ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection'))
152
+            ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection'))
153 153
             ->with('parsedRoutes', $parsedRouteOutput);
154 154
 
155
-        if (! is_dir($outputPath)) {
155
+        if (!is_dir($outputPath)) {
156 156
             $documentarian->create($outputPath);
157 157
         }
158 158
 
@@ -165,24 +165,24 @@  discard block
 block discarded – undo
165 165
             ->with('frontmatter', $frontmatter)
166 166
             ->with('infoText', $infoText)
167 167
             ->with('outputPath', $this->option('output'))
168
-            ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection'))
168
+            ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection'))
169 169
             ->with('parsedRoutes', $parsedRouteOutput);
170 170
 
171 171
         file_put_contents($compareFile, $compareMarkdown);
172 172
 
173
-        $this->info('Wrote index.md to: '.$outputPath);
173
+        $this->info('Wrote index.md to: ' . $outputPath);
174 174
 
175 175
         $this->info('Generating API HTML code');
176 176
 
177 177
         $documentarian->generate($outputPath);
178 178
 
179
-        $this->info('Wrote HTML documentation to: '.$outputPath.'/public/index.html');
179
+        $this->info('Wrote HTML documentation to: ' . $outputPath . '/public/index.html');
180 180
 
181 181
 
182 182
         if ($this->option('noPostmanCollection') !== true) {
183 183
             $this->info('Generating Postman collection');
184 184
 
185
-            file_put_contents($outputPath.DIRECTORY_SEPARATOR.'collection.json', $this->generatePostmanCollection($parsedRoutes));
185
+            file_put_contents($outputPath . DIRECTORY_SEPARATOR . 'collection.json', $this->generatePostmanCollection($parsedRoutes));
186 186
         }
187 187
     }
188 188
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     private function setUserToBeImpersonated($actAs)
212 212
     {
213
-        if (! empty($actAs)) {
213
+        if (!empty($actAs)) {
214 214
             if (version_compare($this->laravel->version(), '5.2.0', '<')) {
215 215
                 $userModel = config('auth.model');
216 216
                 $user = $userModel::find($actAs);
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
             if (in_array($route->getName(), $allowedRoutes) || str_is($routePrefix, $route->getUri())) {
253 253
                 if ($this->isValidRoute($route) && $this->isRouteVisibleForDocumentation($route->getAction()['uses'])) {
254 254
                     $parsedRoutes[] = $generator->processRoute($route, $bindings, $withResponse);
255
-                    $this->info('Processed route: ['.implode(',', $route->getMethods()).'] '.$route->getUri());
255
+                    $this->info('Processed route: [' . implode(',', $route->getMethods()) . '] ' . $route->getUri());
256 256
                 } else {
257
-                    $this->warn('Skipping route: ['.implode(',', $route->getMethods()).'] '.$route->getUri());
257
+                    $this->warn('Skipping route: [' . implode(',', $route->getMethods()) . '] ' . $route->getUri());
258 258
                 }
259 259
             }
260 260
         }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         foreach ($routes as $route) {
279 279
             if (empty($allowedRoutes) || in_array($route->getName(), $allowedRoutes) || str_is($routePrefix, $route->uri())) {
280 280
                 $parsedRoutes[] = $generator->processRoute($route, $bindings, $withResponse);
281
-                $this->info('Processed route: ['.implode(',', $route->getMethods()).'] '.$route->uri());
281
+                $this->info('Processed route: [' . implode(',', $route->getMethods()) . '] ' . $route->uri());
282 282
             }
283 283
         }
284 284
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
      */
293 293
     private function isValidRoute($route)
294 294
     {
295
-        return ! is_callable($route->getAction()['uses']) && ! is_null($route->getAction()['uses']);
295
+        return !is_callable($route->getAction()['uses']) && !is_null($route->getAction()['uses']);
296 296
     }
297 297
 
298 298
     /**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             $phpdoc = new DocBlock($comment);
310 310
 
311 311
             return collect($phpdoc->getTags())
312
-                ->filter(function ($tag) use ($route) {
312
+                ->filter(function($tag) use ($route) {
313 313
                     return $tag->getName() === 'hideFromAPIDocumentation';
314 314
                 })
315 315
                 ->isEmpty();
Please login to merge, or discard this patch.
src/Mpociot/ApiDoc/ApiDocGeneratorServiceProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function boot()
17 17
     {
18
-        $this->loadViewsFrom(__DIR__.'/../../resources/views/', 'apidoc');
19
-        $this->loadTranslationsFrom(__DIR__.'/../../resources/lang', 'apidoc');
18
+        $this->loadViewsFrom(__DIR__ . '/../../resources/views/', 'apidoc');
19
+        $this->loadTranslationsFrom(__DIR__ . '/../../resources/lang', 'apidoc');
20 20
 
21 21
         $this->publishes([
22
-            __DIR__.'/../../resources/lang' => $this->resource_path('lang/vendor/apidoc'),
23
-            __DIR__.'/../../resources/views' => $this->resource_path('views/vendor/apidoc'),
22
+            __DIR__ . '/../../resources/lang' => $this->resource_path('lang/vendor/apidoc'),
23
+            __DIR__ . '/../../resources/views' => $this->resource_path('views/vendor/apidoc'),
24 24
         ]);
25 25
     }
26 26
 
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function register()
33 33
     {
34
-        $this->app['apidoc.generate'] = $this->app->share(function () {
34
+        $this->app['apidoc.generate'] = $this->app->share(function() {
35 35
             return new GenerateDocumentation();
36 36
         });
37
-        $this->app['apidoc.update'] = $this->app->share(function () {
37
+        $this->app['apidoc.update'] = $this->app->share(function() {
38 38
             return new UpdateDocumentation();
39 39
         });
40 40
 
@@ -53,6 +53,6 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function resource_path($path = '')
55 55
     {
56
-        return app()->basePath().'/resources'.($path ? '/'.$path : $path);
56
+        return app()->basePath() . '/resources' . ($path ? '/' . $path : $path);
57 57
     }
58 58
 }
Please login to merge, or discard this patch.
src/Mpociot/ApiDoc/Generators/AbstractGenerator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     {
80 80
         $uri = $this->getUri($route);
81 81
         foreach ($bindings as $model => $id) {
82
-            $uri = str_replace('{'.$model.'}', $id, $uri);
82
+            $uri = str_replace('{' . $model . '}', $id, $uri);
83 83
         }
84 84
 
85 85
         return $uri;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
         foreach ($reflectionMethod->getParameters() as $parameter) {
143 143
             $parameterType = $parameter->getClass();
144
-            if (! is_null($parameterType) && class_exists($parameterType->name)) {
144
+            if (!is_null($parameterType) && class_exists($parameterType->name)) {
145 145
                 $className = $parameterType->name;
146 146
 
147 147
                 if (is_subclass_of($className, FormRequest::class)) {
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
      */
172 172
     protected function fancyImplode($arr, $first, $last)
173 173
     {
174
-        $arr = array_map(function ($value) {
175
-            return '`'.$value.'`';
174
+        $arr = array_map(function($value) {
175
+            return '`' . $value . '`';
176 176
         }, $arr);
177 177
         array_push($arr, implode($last, array_splice($arr, -2)));
178 178
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                 $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
236 236
                 break;
237 237
             case 'between':
238
-                if (! isset($attributeData['type'])) {
238
+                if (!isset($attributeData['type'])) {
239 239
                     $attributeData['type'] = 'numeric';
240 240
                 }
241 241
                 $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
         foreach ($headers as $name => $value) {
393 393
             $name = strtr(strtoupper($name), '-', '_');
394 394
 
395
-            if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
396
-                $name = $prefix.$name;
395
+            if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
396
+                $name = $prefix . $name;
397 397
             }
398 398
 
399 399
             $server[$name] = $value;
Please login to merge, or discard this patch.