@@ -41,7 +41,6 @@ |
||
| 41 | 41 | /** |
| 42 | 42 | * Prepares / Disables route middlewares. |
| 43 | 43 | * |
| 44 | - * @param bool $disable |
|
| 45 | 44 | * |
| 46 | 45 | * @return void |
| 47 | 46 | */ |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | */ |
| 58 | 58 | public function prepareMiddleware($enable = true) |
| 59 | 59 | { |
| 60 | - App::instance('middleware.disable', ! $enable); |
|
| 60 | + App::instance('middleware.disable', !$enable); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | $dispatcher = app('Dingo\Api\Dispatcher')->raw(); |
| 27 | 27 | |
| 28 | - collect($server)->map(function ($key, $value) use ($dispatcher) { |
|
| 28 | + collect($server)->map(function($key, $value) use ($dispatcher) { |
|
| 29 | 29 | $dispatcher->header($value, $key); |
| 30 | 30 | }); |
| 31 | 31 | |
@@ -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.'/index.html'); |
|
| 56 | + $this->info('Wrote HTML documentation to: ' . $outputPath . '/index.html'); |
|
| 57 | 57 | } |
| 58 | 58 | } |
@@ -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'] : '', |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | private function getAllRoutes(bool $usingDingoRouter, array $versions = []) |
| 50 | 50 | { |
| 51 | - if (! $usingDingoRouter) { |
|
| 51 | + if (!$usingDingoRouter) { |
|
| 52 | 52 | return RouteFacade::getRoutes(); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $allRouteCollections = app(\Dingo\Api\Routing\Router::class)->getRoutes(); |
| 56 | 56 | |
| 57 | 57 | return collect($allRouteCollections) |
| 58 | - ->flatMap(function (RouteCollection $collection) { |
|
| 58 | + ->flatMap(function(RouteCollection $collection) { |
|
| 59 | 59 | return $collection->getRoutes(); |
| 60 | 60 | })->toArray(); |
| 61 | 61 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | private function shouldIncludeRoute(Route $route, array $routeRule, array $mustIncludes, bool $usingDingoRouter) |
| 64 | 64 | { |
| 65 | 65 | $matchesVersion = $usingDingoRouter |
| 66 | - ? ! empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? [])) |
|
| 66 | + ? !empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? [])) |
|
| 67 | 67 | : true; |
| 68 | 68 | |
| 69 | 69 | return in_array($route->getName(), $mustIncludes) |
@@ -15,17 +15,17 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function boot() |
| 17 | 17 | { |
| 18 | - $this->loadViewsFrom(__DIR__.'/../resources/views/', 'apidoc'); |
|
| 18 | + $this->loadViewsFrom(__DIR__ . '/../resources/views/', 'apidoc'); |
|
| 19 | 19 | |
| 20 | 20 | $this->publishes([ |
| 21 | - __DIR__.'/../resources/views' => app()->basePath().'/resources/views/vendor/apidoc', |
|
| 21 | + __DIR__ . '/../resources/views' => app()->basePath() . '/resources/views/vendor/apidoc', |
|
| 22 | 22 | ], 'views'); |
| 23 | 23 | |
| 24 | 24 | $this->publishes([ |
| 25 | - __DIR__.'/../config/apidoc.php' => config_path('apidoc.php'), |
|
| 25 | + __DIR__ . '/../config/apidoc.php' => config_path('apidoc.php'), |
|
| 26 | 26 | ], 'config'); |
| 27 | 27 | |
| 28 | - $this->mergeConfigFrom(__DIR__.'/../config/apidoc.php', 'apidoc'); |
|
| 28 | + $this->mergeConfigFrom(__DIR__ . '/../config/apidoc.php', 'apidoc'); |
|
| 29 | 29 | |
| 30 | 30 | if ($this->app->runningInConsole()) { |
| 31 | 31 | $this->commands([ |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * @param Route $route |
| 29 | 29 | * |
| 30 | - * @return mixed |
|
| 30 | + * @return string |
|
| 31 | 31 | */ |
| 32 | 32 | public function getUri(Route $route) |
| 33 | 33 | { |
@@ -46,7 +46,6 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @param \Illuminate\Routing\Route $route |
| 49 | - * @param array $apply Rules to apply when generating documentation for this route |
|
| 50 | 49 | * |
| 51 | 50 | * @return array |
| 52 | 51 | */ |
@@ -73,7 +72,6 @@ discard block |
||
| 73 | 72 | /** |
| 74 | 73 | * Prepares / Disables route middlewares. |
| 75 | 74 | * |
| 76 | - * @param bool $disable |
|
| 77 | 75 | * |
| 78 | 76 | * @return void |
| 79 | 77 | */ |
@@ -168,7 +166,7 @@ discard block |
||
| 168 | 166 | * @param $route |
| 169 | 167 | * @param array $bindings |
| 170 | 168 | * |
| 171 | - * @return mixed |
|
| 169 | + * @return string |
|
| 172 | 170 | */ |
| 173 | 171 | protected function addRouteModelBindings($route, $bindings) |
| 174 | 172 | { |
@@ -184,7 +182,7 @@ discard block |
||
| 184 | 182 | /** |
| 185 | 183 | * @param \Illuminate\Routing\Route $route |
| 186 | 184 | * |
| 187 | - * @return array |
|
| 185 | + * @return Route |
|
| 188 | 186 | */ |
| 189 | 187 | protected function parseDocBlock($route) |
| 190 | 188 | { |
@@ -392,6 +390,9 @@ discard block |
||
| 392 | 390 | return $content; |
| 393 | 391 | } |
| 394 | 392 | |
| 393 | + /** |
|
| 394 | + * @return string |
|
| 395 | + */ |
|
| 395 | 396 | private function normalizeParameterType($type) |
| 396 | 397 | { |
| 397 | 398 | $typeMap = [ |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $content = $this->getResponse($docBlock['tags']); |
| 59 | 59 | |
| 60 | 60 | return [ |
| 61 | - 'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))), |
|
| 61 | + 'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))), |
|
| 62 | 62 | 'resource' => $routeGroup, |
| 63 | 63 | 'title' => $docBlock['short'], |
| 64 | 64 | 'description' => $docBlock['long'], |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | 'uri' => $this->getUri($route), |
| 67 | 67 | 'parameters' => $this->getParametersFromDocBlock($docBlock['tags']), |
| 68 | 68 | 'response' => $content, |
| 69 | - 'showresponse' => ! empty($content), |
|
| 69 | + 'showresponse' => !empty($content), |
|
| 70 | 70 | ]; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | protected function getDocblockResponse($tags) |
| 90 | 90 | { |
| 91 | - $responseTags = array_filter($tags, function ($tag) { |
|
| 91 | + $responseTags = array_filter($tags, function($tag) { |
|
| 92 | 92 | return $tag instanceof Tag && \strtolower($tag->getName()) == 'response'; |
| 93 | 93 | }); |
| 94 | 94 | if (empty($responseTags)) { |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | protected function getParametersFromDocBlock($tags) |
| 108 | 108 | { |
| 109 | 109 | $parameters = collect($tags) |
| 110 | - ->filter(function ($tag) { |
|
| 110 | + ->filter(function($tag) { |
|
| 111 | 111 | return $tag instanceof Tag && $tag->getName() === 'bodyParam'; |
| 112 | 112 | }) |
| 113 | - ->mapWithKeys(function ($tag) { |
|
| 113 | + ->mapWithKeys(function($tag) { |
|
| 114 | 114 | preg_match('/(.+?)\s+(.+?)\s+(required\s+)?(.*)/', $tag->getContent(), $content); |
| 115 | 115 | if (empty($content)) { |
| 116 | 116 | // this means only name and type were supplied |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $methods = $this->getMethods($route); |
| 151 | 151 | |
| 152 | 152 | // Split headers into key - value pairs |
| 153 | - $headers = collect($headers)->map(function ($value) { |
|
| 153 | + $headers = collect($headers)->map(function($value) { |
|
| 154 | 154 | $split = explode(':', $value); // explode to get key + values |
| 155 | 155 | $key = array_shift($split); // extract the key and keep the values in the array |
| 156 | 156 | $value = implode(':', $split); // implode values into string again |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | { |
| 175 | 175 | $uri = $this->getUri($route); |
| 176 | 176 | foreach ($bindings as $model => $id) { |
| 177 | - $uri = str_replace('{'.$model.'}', $id, $uri); |
|
| 178 | - $uri = str_replace('{'.$model.'?}', $id, $uri); |
|
| 177 | + $uri = str_replace('{' . $model . '}', $id, $uri); |
|
| 178 | + $uri = str_replace('{' . $model . '?}', $id, $uri); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | return $uri; |
@@ -254,8 +254,8 @@ discard block |
||
| 254 | 254 | foreach ($headers as $name => $value) { |
| 255 | 255 | $name = strtr(strtoupper($name), '-', '_'); |
| 256 | 256 | |
| 257 | - if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') { |
|
| 258 | - $name = $prefix.$name; |
|
| 257 | + if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') { |
|
| 258 | + $name = $prefix . $name; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | $server[$name] = $value; |
@@ -293,8 +293,8 @@ discard block |
||
| 293 | 293 | protected function getTransformerResponse($tags) |
| 294 | 294 | { |
| 295 | 295 | try { |
| 296 | - $transFormerTags = array_filter($tags, function ($tag) { |
|
| 297 | - if (! ($tag instanceof Tag)) { |
|
| 296 | + $transFormerTags = array_filter($tags, function($tag) { |
|
| 297 | + if (!($tag instanceof Tag)) { |
|
| 298 | 298 | return false; |
| 299 | 299 | } |
| 300 | 300 | |
@@ -305,8 +305,8 @@ discard block |
||
| 305 | 305 | return false; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - $modelTag = array_first(array_filter($tags, function ($tag) { |
|
| 309 | - if (! ($tag instanceof Tag)) { |
|
| 308 | + $modelTag = array_first(array_filter($tags, function($tag) { |
|
| 309 | + if (!($tag instanceof Tag)) { |
|
| 310 | 310 | return false; |
| 311 | 311 | } |
| 312 | 312 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | })); |
| 315 | 315 | $tag = \array_first($transFormerTags); |
| 316 | 316 | $transformer = $tag->getContent(); |
| 317 | - if (! \class_exists($transformer)) { |
|
| 317 | + if (!\class_exists($transformer)) { |
|
| 318 | 318 | // if we can't find the transformer we can't generate a response |
| 319 | 319 | return; |
| 320 | 320 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | if (\is_null($type)) { |
| 331 | 331 | if ($parameter->hasType() && |
| 332 | - ! $parameter->getType()->isBuiltin() && |
|
| 332 | + !$parameter->getType()->isBuiltin() && |
|
| 333 | 333 | \class_exists((string) $parameter->getType())) { |
| 334 | 334 | //we have a type |
| 335 | 335 | $type = (string) $parameter->getType(); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | // we have a response from the docblock ( @response ) |
| 383 | 383 | $response = $docblockResponse; |
| 384 | 384 | } |
| 385 | - if (! $response && ($transformerResponse = $this->getTransformerResponse($annotationTags))) { |
|
| 385 | + if (!$response && ($transformerResponse = $this->getTransformerResponse($annotationTags))) { |
|
| 386 | 386 | // we have a transformer response from the docblock ( @transformer || @transformercollection ) |
| 387 | 387 | $response = $transformerResponse; |
| 388 | 388 | } |
@@ -407,25 +407,25 @@ discard block |
||
| 407 | 407 | { |
| 408 | 408 | $faker = Factory::create(); |
| 409 | 409 | $fakes = [ |
| 410 | - 'integer' => function () { |
|
| 410 | + 'integer' => function() { |
|
| 411 | 411 | return rand(1, 20); |
| 412 | 412 | }, |
| 413 | - 'number' => function () use ($faker) { |
|
| 413 | + 'number' => function() use ($faker) { |
|
| 414 | 414 | return $faker->randomFloat(); |
| 415 | 415 | }, |
| 416 | - 'float' => function () use ($faker) { |
|
| 416 | + 'float' => function() use ($faker) { |
|
| 417 | 417 | return $faker->randomFloat(); |
| 418 | 418 | }, |
| 419 | - 'boolean' => function () use ($faker) { |
|
| 419 | + 'boolean' => function() use ($faker) { |
|
| 420 | 420 | return $faker->boolean(); |
| 421 | 421 | }, |
| 422 | - 'string' => function () use ($faker) { |
|
| 422 | + 'string' => function() use ($faker) { |
|
| 423 | 423 | return str_random(); |
| 424 | 424 | }, |
| 425 | - 'array' => function () { |
|
| 425 | + 'array' => function() { |
|
| 426 | 426 | return '[]'; |
| 427 | 427 | }, |
| 428 | - 'object' => function () { |
|
| 428 | + 'object' => function() { |
|
| 429 | 429 | return '{}'; |
| 430 | 430 | }, |
| 431 | 431 | ]; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $parsedRoutes = $this->processRoutes($generator, $routes); |
| 61 | 61 | $parsedRoutes = collect($parsedRoutes)->groupBy('resource') |
| 62 | - ->sort(function ($a, $b) { |
|
| 62 | + ->sort(function($a, $b) { |
|
| 63 | 63 | return strcmp($a->first()['resource'], $b->first()['resource']); |
| 64 | 64 | }); |
| 65 | 65 | |
@@ -74,17 +74,17 @@ discard block |
||
| 74 | 74 | private function writeMarkdown($parsedRoutes) |
| 75 | 75 | { |
| 76 | 76 | $outputPath = config('apidoc.output'); |
| 77 | - $targetFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'index.md'; |
|
| 78 | - $compareFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'.compare.md'; |
|
| 79 | - $prependFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'prepend.md'; |
|
| 80 | - $appendFile = $outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'append.md'; |
|
| 77 | + $targetFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'index.md'; |
|
| 78 | + $compareFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . '.compare.md'; |
|
| 79 | + $prependFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'prepend.md'; |
|
| 80 | + $appendFile = $outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'append.md'; |
|
| 81 | 81 | |
| 82 | 82 | $infoText = view('apidoc::partials.info') |
| 83 | 83 | ->with('outputPath', ltrim($outputPath, 'public/')) |
| 84 | 84 | ->with('showPostmanCollectionButton', config('apidoc.postman')); |
| 85 | 85 | |
| 86 | - $parsedRouteOutput = $parsedRoutes->map(function ($routeGroup) { |
|
| 87 | - return $routeGroup->map(function ($route) { |
|
| 86 | + $parsedRouteOutput = $parsedRoutes->map(function($routeGroup) { |
|
| 87 | + return $routeGroup->map(function($route) { |
|
| 88 | 88 | $route['output'] = (string) view('apidoc::partials.route')->with('parsedRoute', $route)->render(); |
| 89 | 89 | |
| 90 | 90 | return $route; |
@@ -104,16 +104,16 @@ discard block |
||
| 104 | 104 | $frontmatter = trim($generatedFrontmatter[1], "\n"); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - $parsedRouteOutput->transform(function ($routeGroup) use ($generatedDocumentation, $compareDocumentation) { |
|
| 108 | - return $routeGroup->transform(function ($route) use ($generatedDocumentation, $compareDocumentation) { |
|
| 109 | - if (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $generatedDocumentation, $existingRouteDoc)) { |
|
| 110 | - $routeDocumentationChanged = (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $compareDocumentation, $lastDocWeGeneratedForThisRoute) && $lastDocWeGeneratedForThisRoute[1] !== $existingRouteDoc[1]); |
|
| 107 | + $parsedRouteOutput->transform(function($routeGroup) use ($generatedDocumentation, $compareDocumentation) { |
|
| 108 | + return $routeGroup->transform(function($route) use ($generatedDocumentation, $compareDocumentation) { |
|
| 109 | + if (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $generatedDocumentation, $existingRouteDoc)) { |
|
| 110 | + $routeDocumentationChanged = (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $compareDocumentation, $lastDocWeGeneratedForThisRoute) && $lastDocWeGeneratedForThisRoute[1] !== $existingRouteDoc[1]); |
|
| 111 | 111 | if ($routeDocumentationChanged === false || $this->option('force')) { |
| 112 | 112 | if ($routeDocumentationChanged) { |
| 113 | - $this->warn('Discarded manual changes for route ['.implode(',', $route['methods']).'] '.$route['uri']); |
|
| 113 | + $this->warn('Discarded manual changes for route [' . implode(',', $route['methods']) . '] ' . $route['uri']); |
|
| 114 | 114 | } |
| 115 | 115 | } else { |
| 116 | - $this->warn('Skipping modified route ['.implode(',', $route['methods']).'] '.$route['uri']); |
|
| 116 | + $this->warn('Skipping modified route [' . implode(',', $route['methods']) . '] ' . $route['uri']); |
|
| 117 | 117 | $route['modified_output'] = $existingRouteDoc[0]; |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -124,9 +124,9 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $prependFileContents = file_exists($prependFile) |
| 127 | - ? file_get_contents($prependFile)."\n" : ''; |
|
| 127 | + ? file_get_contents($prependFile) . "\n" : ''; |
|
| 128 | 128 | $appendFileContents = file_exists($appendFile) |
| 129 | - ? "\n".file_get_contents($appendFile) : ''; |
|
| 129 | + ? "\n" . file_get_contents($appendFile) : ''; |
|
| 130 | 130 | |
| 131 | 131 | $documentarian = new Documentarian(); |
| 132 | 132 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | ->with('showPostmanCollectionButton', config('apidoc.postman')) |
| 141 | 141 | ->with('parsedRoutes', $parsedRouteOutput); |
| 142 | 142 | |
| 143 | - if (! is_dir($outputPath)) { |
|
| 143 | + if (!is_dir($outputPath)) { |
|
| 144 | 144 | $documentarian->create($outputPath); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -160,24 +160,24 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | file_put_contents($compareFile, $compareMarkdown); |
| 162 | 162 | |
| 163 | - $this->info('Wrote index.md to: '.$outputPath); |
|
| 163 | + $this->info('Wrote index.md to: ' . $outputPath); |
|
| 164 | 164 | |
| 165 | 165 | $this->info('Generating API HTML code'); |
| 166 | 166 | |
| 167 | 167 | $documentarian->generate($outputPath); |
| 168 | 168 | |
| 169 | - $this->info('Wrote HTML documentation to: '.$outputPath.'/index.html'); |
|
| 169 | + $this->info('Wrote HTML documentation to: ' . $outputPath . '/index.html'); |
|
| 170 | 170 | |
| 171 | 171 | if (config('apidoc.postman')) { |
| 172 | 172 | $this->info('Generating Postman collection'); |
| 173 | 173 | |
| 174 | - file_put_contents($outputPath.DIRECTORY_SEPARATOR.'collection.json', $this->generatePostmanCollection($parsedRoutes)); |
|
| 174 | + file_put_contents($outputPath . DIRECTORY_SEPARATOR . 'collection.json', $this->generatePostmanCollection($parsedRoutes)); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if ($logo = config('apidoc.logo')) { |
| 178 | 178 | Storage::copy( |
| 179 | 179 | $logo, |
| 180 | - $outputPath.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'logo.png' |
|
| 180 | + $outputPath . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'logo.png' |
|
| 181 | 181 | ); |
| 182 | 182 | } |
| 183 | 183 | } |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | /** @var Route $route */ |
| 197 | 197 | if ($this->isValidRoute($route) && $this->isRouteVisibleForDocumentation($route->getAction()['uses'])) { |
| 198 | 198 | $parsedRoutes[] = $generator->processRoute($route) + $routeItem['apply']; |
| 199 | - $this->info('Processed route: ['.implode(',', $generator->getMethods($route)).'] '.$generator->getUri($route)); |
|
| 199 | + $this->info('Processed route: [' . implode(',', $generator->getMethods($route)) . '] ' . $generator->getUri($route)); |
|
| 200 | 200 | } else { |
| 201 | - $this->warn('Skipping route: ['.implode(',', $generator->getMethods($route)).'] '.$generator->getUri($route)); |
|
| 201 | + $this->warn('Skipping route: [' . implode(',', $generator->getMethods($route)) . '] ' . $generator->getUri($route)); |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | private function isValidRoute(Route $route) |
| 214 | 214 | { |
| 215 | - return ! is_callable($route->getAction()['uses']) && ! is_null($route->getAction()['uses']); |
|
| 215 | + return !is_callable($route->getAction()['uses']) && !is_null($route->getAction()['uses']); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $phpdoc = new DocBlock($comment); |
| 230 | 230 | |
| 231 | 231 | return collect($phpdoc->getTags()) |
| 232 | - ->filter(function ($tag) use ($route) { |
|
| 232 | + ->filter(function($tag) use ($route) { |
|
| 233 | 233 | return $tag->getName() === 'hideFromAPIDocumentation'; |
| 234 | 234 | }) |
| 235 | 235 | ->isEmpty(); |