Completed
Push — master ( 8d9a85...38fe88 )
by Marcel
02:43
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/Generators/LaravelGenerator.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 
12 12
     /**
13 13
      * @param Route $route
14
-     * @return mixed
14
+     * @return string
15 15
      */
16 16
     protected function getUri(Route $route)
17 17
     {
Please login to merge, or discard this 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/Generators/AbstractGenerator.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     }
54 54
 
55 55
     /**
56
-     * @param  $route
56
+     * @param  \Illuminate\Routing\Route $route
57 57
      *
58 58
      * @return \Illuminate\Http\Response
59 59
      */
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
      * @param  string  $rule
411 411
      * @param  string  $parameter
412 412
      *
413
-     * @return array
413
+     * @return string
414 414
      */
415 415
     protected function parseParameters($rule, $parameter)
416 416
     {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     {
79 79
         $uri = $this->getUri($route);
80 80
         foreach ($bindings as $model => $id) {
81
-            $uri = str_replace('{'.$model.'}', $id, $uri);
81
+            $uri = str_replace('{' . $model . '}', $id, $uri);
82 82
         }
83 83
 
84 84
         return $uri;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
         foreach ($reflectionMethod->getParameters() as $parameter) {
141 141
             $parameterType = $parameter->getClass();
142
-            if (! is_null($parameterType) && class_exists($parameterType->name)) {
142
+            if (!is_null($parameterType) && class_exists($parameterType->name)) {
143 143
                 $className = $parameterType->name;
144 144
                 $parameterReflection = new $className;
145 145
                 if ($parameterReflection instanceof FormRequest) {
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
      */
165 165
     protected function fancyImplode($arr, $first, $last)
166 166
     {
167
-        $arr = array_map(function ($value) {
168
-            return '`'.$value.'`';
167
+        $arr = array_map(function($value) {
168
+            return '`' . $value . '`';
169 169
         }, $arr);
170 170
         array_push($arr, implode($last, array_splice($arr, -2)));
171 171
 
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
         foreach ($headers as $name => $value) {
376 376
             $name = strtr(strtoupper($name), '-', '_');
377 377
 
378
-            if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
379
-                $name = $prefix.$name;
378
+            if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
379
+                $name = $prefix . $name;
380 380
             }
381 381
 
382 382
             $server[$name] = $value;
Please login to merge, or discard this patch.
src/Mpociot/ApiDoc/Parsers/RuleDescriptionParser.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
     }
78 78
 
79 79
     /**
80
-     * @param null $rule
80
+     * @param string $rule
81 81
      *
82 82
      * @return static
83 83
      */
Please login to merge, or discard this 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/ApiDocGeneratorServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  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'),
22
+            __DIR__ . '/../../resources/lang' => $this->resource_path('lang/vendor/apidoc'),
23 23
         ]);
24 24
     }
25 25
 
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function register()
32 32
     {
33
-        $this->app['apidoc.generate'] = $this->app->share(function () {
33
+        $this->app['apidoc.generate'] = $this->app->share(function() {
34 34
             return new GenerateDocumentation();
35 35
         });
36
-        $this->app['apidoc.update'] = $this->app->share(function () {
36
+        $this->app['apidoc.update'] = $this->app->share(function() {
37 37
             return new UpdateDocumentation();
38 38
         });
39 39
 
@@ -52,6 +52,6 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function resource_path($path = '')
54 54
     {
55
-        return app()->basePath().'/resources'.($path ? '/'.$path : $path);
55
+        return app()->basePath() . '/resources' . ($path ? '/' . $path : $path);
56 56
     }
57 57
 }
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/Commands/GenerateDocumentation.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
         $this->setUserToBeImpersonated($this->option('actAsUserId'));
67 67
 
68
-        if ($routePrefix === null && ! count($allowedRoutes)) {
68
+        if ($routePrefix === null && !count($allowedRoutes)) {
69 69
             $this->error('You must provide either a route prefix or a route to generate the documentation.');
70 70
 
71 71
             return false;
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
     private function writeMarkdown($parsedRoutes)
90 90
     {
91 91
         $outputPath = $this->option('output');
92
-        $targetFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'index.md';
92
+        $targetFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'index.md';
93 93
 
94 94
         $infoText = view('apidoc::partials.info')
95 95
             ->with('outputPath', $this->option('output'))
96
-            ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection'));
96
+            ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection'));
97 97
 
98
-        $parsedRouteOutput = $parsedRoutes->map(function ($routeGroup) {
99
-            return $routeGroup->map(function($route){
100
-                $route['output'] = (string)view('apidoc::partials.route')->with('parsedRoute', $route);
98
+        $parsedRouteOutput = $parsedRoutes->map(function($routeGroup) {
99
+            return $routeGroup->map(function($route) {
100
+                $route['output'] = (string) view('apidoc::partials.route')->with('parsedRoute', $route);
101 101
                 return $route;
102 102
             });
103 103
         });
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
             $generatedDocumentation = file_get_contents($targetFile);
112 112
 
113 113
             if (preg_match("/<!-- START_INFO -->(.*)<!-- END_INFO -->/is", $generatedDocumentation, $generatedInfoText)) {
114
-                $infoText = trim($generatedInfoText[1],"\n");
114
+                $infoText = trim($generatedInfoText[1], "\n");
115 115
             }
116 116
 
117 117
             if (preg_match("/---(.*)---\\s<!-- START_INFO -->/is", $generatedDocumentation, $generatedFrontmatter)) {
118
-                $frontmatter = trim($generatedFrontmatter[1],"\n");
118
+                $frontmatter = trim($generatedFrontmatter[1], "\n");
119 119
             }
120 120
 
121
-            $parsedRouteOutput->transform(function ($routeGroup) use($generatedDocumentation) {
121
+            $parsedRouteOutput->transform(function($routeGroup) use($generatedDocumentation) {
122 122
                 return $routeGroup->transform(function($route) use($generatedDocumentation) {
123
-                    if (preg_match("/<!-- START_".$route['id']." -->(.*)<!-- END_".$route['id']." -->/is", $generatedDocumentation, $routeMatch) && !$this->option('force')) {
123
+                    if (preg_match("/<!-- START_" . $route['id'] . " -->(.*)<!-- END_" . $route['id'] . " -->/is", $generatedDocumentation, $routeMatch) && !$this->option('force')) {
124 124
                         $route['output'] = $routeMatch[0];
125 125
                     }
126 126
                     return $route;
@@ -134,28 +134,28 @@  discard block
 block discarded – undo
134 134
             ->with('frontmatter', $frontmatter)
135 135
             ->with('infoText', $infoText)
136 136
             ->with('outputPath', $this->option('output'))
137
-            ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection'))
137
+            ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection'))
138 138
             ->with('parsedRoutes', $parsedRouteOutput);
139 139
 
140
-        if (! is_dir($outputPath)) {
140
+        if (!is_dir($outputPath)) {
141 141
             $documentarian->create($outputPath);
142 142
         }
143 143
 
144 144
         file_put_contents($targetFile, $markdown);
145 145
 
146
-        $this->info('Wrote index.md to: '.$outputPath);
146
+        $this->info('Wrote index.md to: ' . $outputPath);
147 147
 
148 148
         $this->info('Generating API HTML code');
149 149
 
150 150
         $documentarian->generate($outputPath);
151 151
 
152
-        $this->info('Wrote HTML documentation to: '.$outputPath.'/public/index.html');
152
+        $this->info('Wrote HTML documentation to: ' . $outputPath . '/public/index.html');
153 153
 
154 154
 
155 155
         if ($this->option('noPostmanCollection') !== true) {
156 156
             $this->info('Generating Postman collection');
157 157
 
158
-            file_put_contents($outputPath.DIRECTORY_SEPARATOR.'collection.json', $this->generatePostmanCollection($parsedRoutes));
158
+            file_put_contents($outputPath . DIRECTORY_SEPARATOR . 'collection.json', $this->generatePostmanCollection($parsedRoutes));
159 159
         }
160 160
     }
161 161
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     private function setUserToBeImpersonated($actAs)
185 185
     {
186
-        if (! empty($actAs)) {
186
+        if (!empty($actAs)) {
187 187
             if (version_compare($this->laravel->version(), '5.2.0', '<')) {
188 188
                 $userModel = config('auth.model');
189 189
                 $user = $userModel::find($actAs);
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
             if (in_array($route->getName(), $allowedRoutes) || str_is($routePrefix, $route->getUri())) {
226 226
                 if ($this->isValidRoute($route)) {
227 227
                     $parsedRoutes[] = $generator->processRoute($route, $bindings, $withResponse);
228
-                    $this->info('Processed route: '.$route->getUri());
228
+                    $this->info('Processed route: ' . $route->getUri());
229 229
                 } else {
230
-                    $this->warn('Skipping route: '.$route->getUri().' - contains closure.');
230
+                    $this->warn('Skipping route: ' . $route->getUri() . ' - contains closure.');
231 231
                 }
232 232
             }
233 233
         }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         foreach ($routes as $route) {
252 252
             if (empty($allowedRoutes) || in_array($route->getName(), $allowedRoutes) || str_is($routePrefix, $route->uri())) {
253 253
                 $parsedRoutes[] = $generator->processRoute($route, $bindings, $withResponse);
254
-                $this->info('Processed route: '.$route->uri());
254
+                $this->info('Processed route: ' . $route->uri());
255 255
             }
256 256
         }
257 257
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      */
266 266
     private function isValidRoute($route)
267 267
     {
268
-        return ! is_callable($route->getAction()['uses']) && ! is_null($route->getAction()['uses']);
268
+        return !is_callable($route->getAction()['uses']) && !is_null($route->getAction()['uses']);
269 269
     }
270 270
 
271 271
     /**
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.