@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | $generatedDocumentation = file_get_contents($targetFile); |
115 | 115 | $compareDocumentation = file_get_contents($compareFile); |
116 | 116 | |
117 | - $parsedRouteOutput->transform(function (Collection $routeGroup) use ($generatedDocumentation, $compareDocumentation) { |
|
118 | - return $routeGroup->transform(function (array $route) use ($generatedDocumentation, $compareDocumentation) { |
|
117 | + $parsedRouteOutput->transform(function(Collection $routeGroup) use ($generatedDocumentation, $compareDocumentation) { |
|
118 | + return $routeGroup->transform(function(array $route) use ($generatedDocumentation, $compareDocumentation) { |
|
119 | 119 | if (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $generatedDocumentation, $existingRouteDoc)) { |
120 | 120 | $routeDocumentationChanged = (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $compareDocumentation, $lastDocWeGeneratedForThisRoute) && $lastDocWeGeneratedForThisRoute[1] !== $existingRouteDoc[1]); |
121 | 121 | if ($routeDocumentationChanged === false || $this->forceIt) { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | $this->output->info('Writing index.md and source files to: ' . $this->getSourceOutputPath()); |
150 | 150 | |
151 | - if (! is_dir($this->getSourceOutputPath())) { |
|
151 | + if (!is_dir($this->getSourceOutputPath())) { |
|
152 | 152 | $documentarian = new Documentarian(); |
153 | 153 | $documentarian->create($this->getSourceOutputPath()); |
154 | 154 | } |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | |
175 | 175 | public function generateMarkdownOutputForEachRoute(Collection $parsedRoutes, array $settings): Collection |
176 | 176 | { |
177 | - $parsedRouteOutput = $parsedRoutes->map(function (Collection $routeGroup) use ($settings) { |
|
178 | - return $routeGroup->map(function (array $route) use ($settings) { |
|
179 | - if (count($route['cleanBodyParameters']) && ! isset($route['headers']['Content-Type'])) { |
|
177 | + $parsedRouteOutput = $parsedRoutes->map(function(Collection $routeGroup) use ($settings) { |
|
178 | + return $routeGroup->map(function(array $route) use ($settings) { |
|
179 | + if (count($route['cleanBodyParameters']) && !isset($route['headers']['Content-Type'])) { |
|
180 | 180 | // Set content type if the user forgot to set it |
181 | 181 | $route['headers']['Content-Type'] = 'application/json'; |
182 | 182 | } |
183 | 183 | |
184 | - $hasRequestOptions = ! empty($route['headers']) || ! empty($route['cleanQueryParameters']) || ! empty($route['cleanBodyParameters']); |
|
184 | + $hasRequestOptions = !empty($route['headers']) || !empty($route['cleanQueryParameters']) || !empty($route['cleanBodyParameters']); |
|
185 | 185 | $route['output'] = (string) view('apidoc::partials.route') |
186 | 186 | ->with('hasRequestOptions', $hasRequestOptions) |
187 | 187 | ->with('route', $route) |
@@ -258,15 +258,15 @@ discard block |
||
258 | 258 | protected function copyAssetsFromSourceFolderToPublicFolder(): void |
259 | 259 | { |
260 | 260 | $publicPath = base_path($this->config->get('output_folder') ?? base_path('public/docs')); |
261 | - if (! is_dir($publicPath)) { |
|
261 | + if (!is_dir($publicPath)) { |
|
262 | 262 | mkdir($publicPath, 0777, true); |
263 | 263 | } |
264 | 264 | |
265 | - if (! is_dir("{$publicPath}/css")) { |
|
265 | + if (!is_dir("{$publicPath}/css")) { |
|
266 | 266 | mkdir("{$publicPath}/css", 0777, true); |
267 | 267 | } |
268 | 268 | |
269 | - if (! is_dir("{$publicPath}/js")) { |
|
269 | + if (!is_dir("{$publicPath}/js")) { |
|
270 | 270 | mkdir("{$publicPath}/js", 0777, true); |
271 | 271 | } |
272 | 272 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | rename("{$this->getSourceOutputPath()}/index.html", "{$this->getOutputPath()}/index.html"); |
291 | 291 | } else { |
292 | 292 | // Move output to resources/views |
293 | - if (! is_dir($this->getOutputPath())) { |
|
293 | + if (!is_dir($this->getOutputPath())) { |
|
294 | 294 | mkdir($this->getOutputPath()); |
295 | 295 | } |
296 | 296 | rename("{$this->getSourceOutputPath()}/index.html", "$this->getOutputPath()/index.blade.php"); |