Completed
Push — master ( c5bcde...74dd9d )
by Marcel
02:45
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 1 patch
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.
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   +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,10 +141,10 @@  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
-                if (is_subclass_of($className,FormRequest::class)) {
147
+                if (is_subclass_of($className, FormRequest::class)) {
148 148
                     $parameterReflection = new $className;
149 149
                     // Add route parameter bindings
150 150
                     $parameterReflection->query->add($bindings);
@@ -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
 
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
         foreach ($headers as $name => $value) {
383 383
             $name = strtr(strtoupper($name), '-', '_');
384 384
 
385
-            if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
386
-                $name = $prefix.$name;
385
+            if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
386
+                $name = $prefix . $name;
387 387
             }
388 388
 
389 389
             $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   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
         $this->setUserToBeImpersonated($this->option('actAsUserId'));
66 66
 
67
-        if ($routePrefix === null && ! count($allowedRoutes)) {
67
+        if ($routePrefix === null && !count($allowedRoutes)) {
68 68
             $this->error('You must provide either a route prefix or a route to generate the documentation.');
69 69
 
70 70
             return false;
@@ -93,28 +93,28 @@  discard block
 block discarded – undo
93 93
 
94 94
         $markdown = view('apidoc::documentarian')
95 95
             ->with('outputPath', $this->option('output'))
96
-            ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection'))
96
+            ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection'))
97 97
             ->with('parsedRoutes', $parsedRoutes->all());
98 98
 
99
-        if (! is_dir($outputPath)) {
99
+        if (!is_dir($outputPath)) {
100 100
             $documentarian->create($outputPath);
101 101
         }
102 102
 
103
-        file_put_contents($outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'index.md', $markdown);
103
+        file_put_contents($outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'index.md', $markdown);
104 104
 
105
-        $this->info('Wrote index.md to: '.$outputPath);
105
+        $this->info('Wrote index.md to: ' . $outputPath);
106 106
 
107 107
         $this->info('Generating API HTML code');
108 108
 
109 109
         $documentarian->generate($outputPath);
110 110
 
111
-        $this->info('Wrote HTML documentation to: '.$outputPath.'/public/index.html');
111
+        $this->info('Wrote HTML documentation to: ' . $outputPath . '/public/index.html');
112 112
 
113 113
 
114 114
         if ($this->option('noPostmanCollection') !== true) {
115 115
             $this->info('Generating Postman collection');
116 116
 
117
-            file_put_contents($outputPath.DIRECTORY_SEPARATOR.'collection.json', $this->generatePostmanCollection($parsedRoutes));
117
+            file_put_contents($outputPath . DIRECTORY_SEPARATOR . 'collection.json', $this->generatePostmanCollection($parsedRoutes));
118 118
         }
119 119
     }
120 120
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     private function setUserToBeImpersonated($actAs)
144 144
     {
145
-        if (! empty($actAs)) {
145
+        if (!empty($actAs)) {
146 146
             if (version_compare($this->laravel->version(), '5.2.0', '<')) {
147 147
                 $userModel = config('auth.model');
148 148
                 $user = $userModel::find($actAs);
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
             if (in_array($route->getName(), $allowedRoutes) || str_is($routePrefix, $route->getUri())) {
185 185
                 if ($this->isValidRoute($route)) {
186 186
                     $parsedRoutes[] = $generator->processRoute($route, $bindings, $withResponse);
187
-                    $this->info('Processed route: '.$route->getUri());
187
+                    $this->info('Processed route: ' . $route->getUri());
188 188
                 } else {
189
-                    $this->warn('Skipping route: '.$route->getUri().' - contains closure.');
189
+                    $this->warn('Skipping route: ' . $route->getUri() . ' - contains closure.');
190 190
                 }
191 191
             }
192 192
         }
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         foreach ($routes as $route) {
211 211
             if (empty($allowedRoutes) || in_array($route->getName(), $allowedRoutes) || str_is($routePrefix, $route->uri())) {
212 212
                 $parsedRoutes[] = $generator->processRoute($route, $bindings, $withResponse);
213
-                $this->info('Processed route: '.$route->uri());
213
+                $this->info('Processed route: ' . $route->uri());
214 214
             }
215 215
         }
216 216
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      */
225 225
     private function isValidRoute($route)
226 226
     {
227
-        return ! is_callable($route->getAction()['uses']) && ! is_null($route->getAction()['uses']);
227
+        return !is_callable($route->getAction()['uses']) && !is_null($route->getAction()['uses']);
228 228
     }
229 229
 
230 230
     /**
Please login to merge, or discard this patch.