@@ -67,7 +67,7 @@ discard block |
||
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,14 +91,14 @@ discard block |
||
91 | 91 | private function writeMarkdown($parsedRoutes) |
92 | 92 | { |
93 | 93 | $outputPath = $this->option('output'); |
94 | - $targetFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'index.md'; |
|
94 | + $targetFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'index.md'; |
|
95 | 95 | |
96 | 96 | $infoText = view('apidoc::partials.info') |
97 | 97 | ->with('outputPath', $this->option('output')) |
98 | - ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection')); |
|
98 | + ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection')); |
|
99 | 99 | |
100 | - $parsedRouteOutput = $parsedRoutes->map(function ($routeGroup) { |
|
101 | - return $routeGroup->map(function ($route) { |
|
100 | + $parsedRouteOutput = $parsedRoutes->map(function($routeGroup) { |
|
101 | + return $routeGroup->map(function($route) { |
|
102 | 102 | $route['output'] = (string) view('apidoc::partials.route')->with('parsedRoute', $route); |
103 | 103 | |
104 | 104 | return $route; |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | $frontmatter = trim($generatedFrontmatter[1], "\n"); |
122 | 122 | } |
123 | 123 | |
124 | - $parsedRouteOutput->transform(function ($routeGroup) use ($generatedDocumentation) { |
|
125 | - return $routeGroup->transform(function ($route) use ($generatedDocumentation) { |
|
126 | - if (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $generatedDocumentation, $routeMatch) && ! $this->option('force')) { |
|
124 | + $parsedRouteOutput->transform(function($routeGroup) use ($generatedDocumentation) { |
|
125 | + return $routeGroup->transform(function($route) use ($generatedDocumentation) { |
|
126 | + if (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $generatedDocumentation, $routeMatch) && !$this->option('force')) { |
|
127 | 127 | $route['output'] = $routeMatch[0]; |
128 | 128 | } |
129 | 129 | |
@@ -138,28 +138,28 @@ discard block |
||
138 | 138 | ->with('frontmatter', $frontmatter) |
139 | 139 | ->with('infoText', $infoText) |
140 | 140 | ->with('outputPath', $this->option('output')) |
141 | - ->with('showPostmanCollectionButton', ! $this->option('noPostmanCollection')) |
|
141 | + ->with('showPostmanCollectionButton', !$this->option('noPostmanCollection')) |
|
142 | 142 | ->with('parsedRoutes', $parsedRouteOutput); |
143 | 143 | |
144 | - if (! is_dir($outputPath)) { |
|
144 | + if (!is_dir($outputPath)) { |
|
145 | 145 | $documentarian->create($outputPath); |
146 | 146 | } |
147 | 147 | |
148 | 148 | file_put_contents($targetFile, $markdown); |
149 | 149 | |
150 | - $this->info('Wrote index.md to: '.$outputPath); |
|
150 | + $this->info('Wrote index.md to: ' . $outputPath); |
|
151 | 151 | |
152 | 152 | $this->info('Generating API HTML code'); |
153 | 153 | |
154 | 154 | $documentarian->generate($outputPath); |
155 | 155 | |
156 | - $this->info('Wrote HTML documentation to: '.$outputPath.'/public/index.html'); |
|
156 | + $this->info('Wrote HTML documentation to: ' . $outputPath . '/public/index.html'); |
|
157 | 157 | |
158 | 158 | |
159 | 159 | if ($this->option('noPostmanCollection') !== true) { |
160 | 160 | $this->info('Generating Postman collection'); |
161 | 161 | |
162 | - file_put_contents($outputPath.DIRECTORY_SEPARATOR.'collection.json', $this->generatePostmanCollection($parsedRoutes)); |
|
162 | + file_put_contents($outputPath . DIRECTORY_SEPARATOR . 'collection.json', $this->generatePostmanCollection($parsedRoutes)); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | private function setUserToBeImpersonated($actAs) |
189 | 189 | { |
190 | - if (! empty($actAs)) { |
|
190 | + if (!empty($actAs)) { |
|
191 | 191 | if (version_compare($this->laravel->version(), '5.2.0', '<')) { |
192 | 192 | $userModel = config('auth.model'); |
193 | 193 | $user = $userModel::find($actAs); |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | if (in_array($route->getName(), $allowedRoutes) || str_is($routePrefix, $route->getUri())) { |
230 | 230 | if ($this->isValidRoute($route) && $this->isRouteVisibleForDocumentation($route->getAction()['uses'])) { |
231 | 231 | $parsedRoutes[] = $generator->processRoute($route, $bindings, $withResponse); |
232 | - $this->info('Processed route: '.$route->getUri()); |
|
232 | + $this->info('Processed route: ' . $route->getUri()); |
|
233 | 233 | } else { |
234 | - $this->warn('Skipping route: '.$route->getUri()); |
|
234 | + $this->warn('Skipping route: ' . $route->getUri()); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | foreach ($routes as $route) { |
256 | 256 | if (empty($allowedRoutes) || in_array($route->getName(), $allowedRoutes) || str_is($routePrefix, $route->uri())) { |
257 | 257 | $parsedRoutes[] = $generator->processRoute($route, $bindings, $withResponse); |
258 | - $this->info('Processed route: '.$route->uri()); |
|
258 | + $this->info('Processed route: ' . $route->uri()); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | private function isValidRoute($route) |
271 | 271 | { |
272 | - return ! is_callable($route->getAction()['uses']) && ! is_null($route->getAction()['uses']); |
|
272 | + return !is_callable($route->getAction()['uses']) && !is_null($route->getAction()['uses']); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |