@@ -65,7 +65,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | /** |
@@ -29,7 +29,7 @@ |
||
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'], |
@@ -44,7 +44,7 @@ |
||
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'], |