@@ -44,8 +44,8 @@ discard block |
||
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 |
||
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 | } |
@@ -77,7 +77,7 @@ |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
80 | - * @param null $rule |
|
80 | + * @param string $rule |
|
81 | 81 | * |
82 | 82 | * @return static |
83 | 83 | */ |
@@ -34,8 +34,7 @@ discard block |
||
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 |
||
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 | } |
@@ -15,12 +15,12 @@ discard block |
||
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 |
||
31 | 31 | */ |
32 | 32 | public function register() |
33 | 33 | { |
34 | - $this->app->singleton('apidoc.generate', function () { |
|
34 | + $this->app->singleton('apidoc.generate', function() { |
|
35 | 35 | return new GenerateDocumentation(); |
36 | 36 | }); |
37 | - $this->app->singleton('apidoc.update', function () { |
|
37 | + $this->app->singleton('apidoc.update', function() { |
|
38 | 38 | return new UpdateDocumentation(); |
39 | 39 | }); |
40 | 40 | |
@@ -53,6 +53,6 @@ discard block |
||
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 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | * |
47 | 47 | * @param bool $disable |
48 | 48 | * |
49 | - * @return void |
|
49 | + * @return boolean |
|
50 | 50 | */ |
51 | 51 | public function prepareMiddleware($disable = true) |
52 | 52 | { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $routeDescription = $this->getRouteDescription($routeAction['uses']); |
31 | 31 | |
32 | 32 | return $this->getParameters([ |
33 | - 'id' => md5($route->uri().':'.implode($route->getMethods())), |
|
33 | + 'id' => md5($route->uri() . ':' . implode($route->getMethods())), |
|
34 | 34 | 'resource' => $routeGroup, |
35 | 35 | 'title' => $routeDescription['short'], |
36 | 36 | 'description' => $routeDescription['long'], |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | $dispatcher = app('Dingo\Api\Dispatcher')->raw(); |
63 | 63 | |
64 | - collect($server)->map(function ($key, $value) use ($dispatcher) { |
|
64 | + collect($server)->map(function($key, $value) use ($dispatcher) { |
|
65 | 65 | $dispatcher->header($value, $key); |
66 | 66 | }); |
67 | 67 |
@@ -32,11 +32,11 @@ discard block |
||
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 |
||
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'] : '', |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function getDocblockResponse($tags) |
57 | 57 | { |
58 | - $responseTags = array_filter($tags, function ($tag) { |
|
59 | - if (! ($tag instanceof Tag)) { |
|
58 | + $responseTags = array_filter($tags, function($tag) { |
|
59 | + if (!($tag instanceof Tag)) { |
|
60 | 60 | return false; |
61 | 61 | } |
62 | 62 | |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | $values = collect($simplifiedRules) |
118 | - ->filter(function ($values) { |
|
118 | + ->filter(function($values) { |
|
119 | 119 | return in_array('array', $values); |
120 | - })->map(function ($val, $key) { |
|
120 | + })->map(function($val, $key) { |
|
121 | 121 | return ['']; |
122 | 122 | })->all(); |
123 | 123 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $methods = $this->getMethods($route); |
139 | 139 | |
140 | 140 | // Split headers into key - value pairs |
141 | - $headers = collect($headers)->map(function ($value) { |
|
141 | + $headers = collect($headers)->map(function($value) { |
|
142 | 142 | $split = explode(':', $value); // explode to get key + values |
143 | 143 | $key = array_shift($split); // extract the key and keep the values in the array |
144 | 144 | $value = implode(':', $split); // implode values into string again |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | { |
163 | 163 | $uri = $this->getUri($route); |
164 | 164 | foreach ($bindings as $model => $id) { |
165 | - $uri = str_replace('{'.$model.'}', $id, $uri); |
|
166 | - $uri = str_replace('{'.$model.'?}', $id, $uri); |
|
165 | + $uri = str_replace('{' . $model . '}', $id, $uri); |
|
166 | + $uri = str_replace('{' . $model . '?}', $id, $uri); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | return $uri; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | foreach ($reflectionMethod->getParameters() as $parameter) { |
228 | 228 | $parameterType = $parameter->getClass(); |
229 | - if (! is_null($parameterType) && class_exists($parameterType->name)) { |
|
229 | + if (!is_null($parameterType) && class_exists($parameterType->name)) { |
|
230 | 230 | $className = $parameterType->name; |
231 | 231 | |
232 | 232 | if (is_subclass_of($className, FormRequest::class)) { |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | */ |
257 | 257 | protected function fancyImplode($arr, $first, $last) |
258 | 258 | { |
259 | - $arr = array_map(function ($value) { |
|
260 | - return '`'.$value.'`'; |
|
259 | + $arr = array_map(function($value) { |
|
260 | + return '`' . $value . '`'; |
|
261 | 261 | }, $arr); |
262 | 262 | array_push($arr, implode($last, array_splice($arr, -2))); |
263 | 263 | |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | protected function splitValuePairs($parameters, $first = 'is ', $last = 'or ') |
268 | 268 | { |
269 | 269 | $attribute = ''; |
270 | - collect($parameters)->map(function ($item, $key) use (&$attribute, $first, $last) { |
|
271 | - $attribute .= '`'.$item.'` '; |
|
270 | + collect($parameters)->map(function($item, $key) use (&$attribute, $first, $last) { |
|
271 | + $attribute .= '`' . $item . '` '; |
|
272 | 272 | if (($key + 1) % 2 === 0) { |
273 | 273 | $attribute .= $last; |
274 | 274 | } else { |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | } |
343 | 343 | break; |
344 | 344 | case 'between': |
345 | - if (! isset($attributeData['type'])) { |
|
345 | + if (!isset($attributeData['type'])) { |
|
346 | 346 | $attributeData['type'] = 'numeric'; |
347 | 347 | } |
348 | 348 | $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription(); |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | foreach ($headers as $name => $value) { |
505 | 505 | $name = strtr(strtoupper($name), '-', '_'); |
506 | 506 | |
507 | - if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') { |
|
508 | - $name = $prefix.$name; |
|
507 | + if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') { |
|
508 | + $name = $prefix . $name; |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | $server[$name] = $value; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @param $route |
19 | 19 | * |
20 | - * @return mixed |
|
20 | + * @return string |
|
21 | 21 | */ |
22 | 22 | abstract public function getDomain($route); |
23 | 23 | |
@@ -47,7 +47,6 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * Prepares / Disables route middlewares. |
49 | 49 | * |
50 | - * @param bool $disable |
|
51 | 50 | * |
52 | 51 | * @return void |
53 | 52 | */ |
@@ -56,9 +55,9 @@ discard block |
||
56 | 55 | /** |
57 | 56 | * Get the response from the docblock if available. |
58 | 57 | * |
59 | - * @param array $tags |
|
58 | + * @param Tag[] $tags |
|
60 | 59 | * |
61 | - * @return mixed |
|
60 | + * @return null|\Symfony\Component\HttpFoundation\Response |
|
62 | 61 | */ |
63 | 62 | protected function getDocblockResponse($tags) |
64 | 63 | { |
@@ -132,7 +131,7 @@ discard block |
||
132 | 131 | } |
133 | 132 | |
134 | 133 | /** |
135 | - * @param $route |
|
134 | + * @param \Illuminate\Routing\Route $route |
|
136 | 135 | * @param $bindings |
137 | 136 | * @param $headers |
138 | 137 | * |
@@ -556,7 +555,7 @@ discard block |
||
556 | 555 | * @param string $rule |
557 | 556 | * @param string $parameter |
558 | 557 | * |
559 | - * @return array |
|
558 | + * @return string |
|
560 | 559 | */ |
561 | 560 | protected function parseParameters($rule, $parameter) |
562 | 561 | { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $response = $docblockResponse; |
68 | 68 | $showresponse = true; |
69 | 69 | } |
70 | - if (! $response) { |
|
70 | + if (!$response) { |
|
71 | 71 | $transformerResponse = $this->getTransformerResponse($routeDescription['tags']); |
72 | 72 | if ($transformerResponse) { |
73 | 73 | // we have a transformer response from the docblock ( @transformer || @transformercollection ) |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $showresponse = true; |
76 | 76 | } |
77 | 77 | } |
78 | - if (! $response) { |
|
78 | + if (!$response) { |
|
79 | 79 | $response = $this->getRouteResponse($route, $bindings, $headers); |
80 | 80 | } |
81 | 81 | if ($response->headers->get('Content-Type') === 'application/json') { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | return $this->getParameters([ |
89 | - 'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))), |
|
89 | + 'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))), |
|
90 | 90 | 'resource' => $routeGroup, |
91 | 91 | 'title' => $routeDescription['short'], |
92 | 92 | 'description' => $routeDescription['long'], |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function prepareMiddleware($enable = true) |
109 | 109 | { |
110 | - App::instance('middleware.disable', ! $enable); |
|
110 | + App::instance('middleware.disable', !$enable); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | protected function getTransformerResponse($tags) |
154 | 154 | { |
155 | 155 | try { |
156 | - $transFormerTags = array_filter($tags, function ($tag) { |
|
157 | - if (! ($tag instanceof Tag)) { |
|
156 | + $transFormerTags = array_filter($tags, function($tag) { |
|
157 | + if (!($tag instanceof Tag)) { |
|
158 | 158 | return false; |
159 | 159 | } |
160 | 160 | |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | return false; |
166 | 166 | } |
167 | 167 | |
168 | - $modelTag = array_first(array_filter($tags, function ($tag) { |
|
169 | - if (! ($tag instanceof Tag)) { |
|
168 | + $modelTag = array_first(array_filter($tags, function($tag) { |
|
169 | + if (!($tag instanceof Tag)) { |
|
170 | 170 | return false; |
171 | 171 | } |
172 | 172 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | })); |
175 | 175 | $tag = \array_first($transFormerTags); |
176 | 176 | $transformer = $tag->getContent(); |
177 | - if (! \class_exists($transformer)) { |
|
177 | + if (!\class_exists($transformer)) { |
|
178 | 178 | // if we can't find the transformer we can't generate a response |
179 | 179 | return; |
180 | 180 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | if (version_compare(PHP_VERSION, '7.0.0') >= 0 && \is_null($type)) { |
191 | 191 | // we can only get the type with reflection for PHP 7 |
192 | 192 | if ($parameter->hasType() && |
193 | - ! $parameter->getType()->isBuiltin() && |
|
193 | + !$parameter->getType()->isBuiltin() && |
|
194 | 194 | \class_exists((string) $parameter->getType())) { |
195 | 195 | //we have a type |
196 | 196 | $type = (string) $parameter->getType(); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | foreach ($reflectionMethod->getParameters() as $parameter) { |
252 | 252 | $parameterType = $parameter->getClass(); |
253 | - if (! is_null($parameterType) && class_exists($parameterType->name)) { |
|
253 | + if (!is_null($parameterType) && class_exists($parameterType->name)) { |
|
254 | 254 | $className = $parameterType->name; |
255 | 255 | |
256 | 256 | if (is_subclass_of($className, FormRequest::class)) { |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @param Route $route |
21 | 21 | * |
22 | - * @return mixed |
|
22 | + * @return string|null |
|
23 | 23 | */ |
24 | 24 | public function getDomain($route) |
25 | 25 | { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * @param Route $route |
46 | 46 | * |
47 | - * @return mixed |
|
47 | + * @return string |
|
48 | 48 | */ |
49 | 49 | public function getMethods($route) |
50 | 50 | { |
@@ -121,7 +121,6 @@ discard block |
||
121 | 121 | /** |
122 | 122 | * Prepares / Disables route middlewares. |
123 | 123 | * |
124 | - * @param bool $disable |
|
125 | 124 | * |
126 | 125 | * @return void |
127 | 126 | */ |
@@ -166,7 +165,7 @@ discard block |
||
166 | 165 | /** |
167 | 166 | * Get a response from the transformer tags. |
168 | 167 | * |
169 | - * @param array $tags |
|
168 | + * @param Tag[] $tags |
|
170 | 169 | * |
171 | 170 | * @return mixed |
172 | 171 | */ |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | $this->setUserToBeImpersonated($this->option('actAsUserId')); |
77 | 77 | |
78 | - if ($routePrefix === null && $routeDomain === null && ! count($allowedRoutes) && $middleware === null) { |
|
78 | + if ($routePrefix === null && $routeDomain === null && !count($allowedRoutes) && $middleware === null) { |
|
79 | 79 | $this->error('You must provide either a route prefix, a route domain, a route or a middleware to generate the documentation.'); |
80 | 80 | |
81 | 81 | return false; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | - $parsedRoutes = collect($parsedRoutes)->groupBy('resource')->sort(function ($a, $b) { |
|
104 | + $parsedRoutes = collect($parsedRoutes)->groupBy('resource')->sort(function($a, $b) { |
|
105 | 105 | return strcmp($a->first()['resource'], $b->first()['resource']); |
106 | 106 | }); |
107 | 107 | |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | private function writeMarkdown($parsedRoutes) |
117 | 117 | { |
118 | 118 | $outputPath = $this->option('output'); |
119 | - $targetFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'index.md'; |
|
120 | - $compareFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'.compare.md'; |
|
119 | + $targetFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'index.md'; |
|
120 | + $compareFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . '.compare.md'; |
|
121 | 121 | |
122 | 122 | $infoText = view('apidoc::partials.info') |
123 | 123 | ->with('outputPath', ltrim($outputPath, 'public/')) |
124 | - ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection')); |
|
124 | + ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection')); |
|
125 | 125 | |
126 | - $parsedRouteOutput = $parsedRoutes->map(function ($routeGroup) { |
|
127 | - return $routeGroup->map(function ($route) { |
|
126 | + $parsedRouteOutput = $parsedRoutes->map(function($routeGroup) { |
|
127 | + return $routeGroup->map(function($route) { |
|
128 | 128 | $route['output'] = (string) view('apidoc::partials.route')->with('parsedRoute', $route)->render(); |
129 | 129 | |
130 | 130 | return $route; |
@@ -144,16 +144,16 @@ discard block |
||
144 | 144 | $frontmatter = trim($generatedFrontmatter[1], "\n"); |
145 | 145 | } |
146 | 146 | |
147 | - $parsedRouteOutput->transform(function ($routeGroup) use ($generatedDocumentation, $compareDocumentation) { |
|
148 | - return $routeGroup->transform(function ($route) use ($generatedDocumentation, $compareDocumentation) { |
|
149 | - if (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $generatedDocumentation, $routeMatch)) { |
|
150 | - $routeDocumentationChanged = (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $compareDocumentation, $compareMatch) && $compareMatch[1] !== $routeMatch[1]); |
|
147 | + $parsedRouteOutput->transform(function($routeGroup) use ($generatedDocumentation, $compareDocumentation) { |
|
148 | + return $routeGroup->transform(function($route) use ($generatedDocumentation, $compareDocumentation) { |
|
149 | + if (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $generatedDocumentation, $routeMatch)) { |
|
150 | + $routeDocumentationChanged = (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $compareDocumentation, $compareMatch) && $compareMatch[1] !== $routeMatch[1]); |
|
151 | 151 | if ($routeDocumentationChanged === false || $this->option('force')) { |
152 | 152 | if ($routeDocumentationChanged) { |
153 | - $this->warn('Discarded manual changes for route ['.implode(',', $route['methods']).'] '.$route['uri']); |
|
153 | + $this->warn('Discarded manual changes for route [' . implode(',', $route['methods']) . '] ' . $route['uri']); |
|
154 | 154 | } |
155 | 155 | } else { |
156 | - $this->warn('Skipping modified route ['.implode(',', $route['methods']).'] '.$route['uri']); |
|
156 | + $this->warn('Skipping modified route [' . implode(',', $route['methods']) . '] ' . $route['uri']); |
|
157 | 157 | $route['modified_output'] = $routeMatch[0]; |
158 | 158 | } |
159 | 159 | } |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | ->with('frontmatter', $frontmatter) |
171 | 171 | ->with('infoText', $infoText) |
172 | 172 | ->with('outputPath', $this->option('output')) |
173 | - ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection')) |
|
173 | + ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection')) |
|
174 | 174 | ->with('parsedRoutes', $parsedRouteOutput); |
175 | 175 | |
176 | - if (! is_dir($outputPath)) { |
|
176 | + if (!is_dir($outputPath)) { |
|
177 | 177 | $documentarian->create($outputPath); |
178 | 178 | } |
179 | 179 | |
@@ -186,23 +186,23 @@ discard block |
||
186 | 186 | ->with('frontmatter', $frontmatter) |
187 | 187 | ->with('infoText', $infoText) |
188 | 188 | ->with('outputPath', $this->option('output')) |
189 | - ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection')) |
|
189 | + ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection')) |
|
190 | 190 | ->with('parsedRoutes', $parsedRouteOutput); |
191 | 191 | |
192 | 192 | file_put_contents($compareFile, $compareMarkdown); |
193 | 193 | |
194 | - $this->info('Wrote index.md to: '.$outputPath); |
|
194 | + $this->info('Wrote index.md to: ' . $outputPath); |
|
195 | 195 | |
196 | 196 | $this->info('Generating API HTML code'); |
197 | 197 | |
198 | 198 | $documentarian->generate($outputPath); |
199 | 199 | |
200 | - $this->info('Wrote HTML documentation to: '.$outputPath.'/public/index.html'); |
|
200 | + $this->info('Wrote HTML documentation to: ' . $outputPath . '/public/index.html'); |
|
201 | 201 | |
202 | 202 | if ($this->option('noPostmanCollection') !== true) { |
203 | 203 | $this->info('Generating Postman collection'); |
204 | 204 | |
205 | - file_put_contents($outputPath.DIRECTORY_SEPARATOR.'collection.json', $this->generatePostmanCollection($parsedRoutes)); |
|
205 | + file_put_contents($outputPath . DIRECTORY_SEPARATOR . 'collection.json', $this->generatePostmanCollection($parsedRoutes)); |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | private function setUserToBeImpersonated($actAs) |
232 | 232 | { |
233 | - if (! empty($actAs)) { |
|
233 | + if (!empty($actAs)) { |
|
234 | 234 | if (version_compare($this->laravel->version(), '5.2.0', '<')) { |
235 | 235 | $userModel = config('auth.model'); |
236 | 236 | $user = $userModel::find($actAs); |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | ) { |
279 | 279 | if ($this->isValidRoute($route) && $this->isRouteVisibleForDocumentation($route->getAction()['uses'])) { |
280 | 280 | $parsedRoutes[] = $generator->processRoute($route, $bindings, $this->option('header'), $withResponse); |
281 | - $this->info('Processed route: ['.implode(',', $generator->getMethods($route)).'] '.$generator->getUri($route)); |
|
281 | + $this->info('Processed route: [' . implode(',', $generator->getMethods($route)) . '] ' . $generator->getUri($route)); |
|
282 | 282 | } else { |
283 | - $this->warn('Skipping route: ['.implode(',', $generator->getMethods($route)).'] '.$generator->getUri($route)); |
|
283 | + $this->warn('Skipping route: [' . implode(',', $generator->getMethods($route)) . '] ' . $generator->getUri($route)); |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | } |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | ) { |
313 | 313 | if ($this->isValidRoute($route) && $this->isRouteVisibleForDocumentation($route->getAction()['uses'])) { |
314 | 314 | $parsedRoutes[] = $generator->processRoute($route, $bindings, $this->option('header'), $withResponse); |
315 | - $this->info('Processed route: ['.implode(',', $route->getMethods()).'] '.$route->uri()); |
|
315 | + $this->info('Processed route: [' . implode(',', $route->getMethods()) . '] ' . $route->uri()); |
|
316 | 316 | } else { |
317 | - $this->warn('Skipping route: ['.implode(',', $route->getMethods()).'] '.$route->uri()); |
|
317 | + $this->warn('Skipping route: [' . implode(',', $route->getMethods()) . '] ' . $route->uri()); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | */ |
330 | 330 | private function isValidRoute($route) |
331 | 331 | { |
332 | - return ! is_callable($route->getAction()['uses']) && ! is_null($route->getAction()['uses']); |
|
332 | + return !is_callable($route->getAction()['uses']) && !is_null($route->getAction()['uses']); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | $phpdoc = new DocBlock($comment); |
347 | 347 | |
348 | 348 | return collect($phpdoc->getTags()) |
349 | - ->filter(function ($tag) use ($route) { |
|
349 | + ->filter(function($tag) use ($route) { |
|
350 | 350 | return $tag->getName() === 'hideFromAPIDocumentation'; |
351 | 351 | }) |
352 | 352 | ->isEmpty(); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | || (str_is($routeDomain, $generator->getDomain($route)) |
276 | 276 | && str_is($routePrefix, $generator->getUri($route))) |
277 | 277 | || in_array($middleware, $route->middleware()) |
278 | - ) { |
|
278 | + ) { |
|
279 | 279 | if ($this->isValidRoute($route) && $this->isRouteVisibleForDocumentation($route->getAction()['uses'])) { |
280 | 280 | $parsedRoutes[] = $generator->processRoute($route, $bindings, $this->option('header'), $withResponse); |
281 | 281 | $this->info('Processed route: ['.implode(',', $generator->getMethods($route)).'] '.$generator->getUri($route)); |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | || (str_is($routeDomain, $generator->getDomain($route)) |
310 | 310 | && str_is($routePrefix, $generator->getUri($route))) |
311 | 311 | || in_array($middleware, $route->middleware()) |
312 | - ) { |
|
312 | + ) { |
|
313 | 313 | if ($this->isValidRoute($route) && $this->isRouteVisibleForDocumentation($route->getAction()['uses'])) { |
314 | 314 | $parsedRoutes[] = $generator->processRoute($route, $bindings, $this->option('header'), $withResponse); |
315 | 315 | $this->info('Processed route: ['.implode(',', $route->getMethods()).'] '.$route->uri()); |