@@ -51,6 +51,9 @@ |
||
| 51 | 51 | return $this->getBodyParametersFromDocBlock($methodDocBlock->getTags()); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | + /** |
|
| 55 | + * @param Tag[] $tags |
|
| 56 | + */ |
|
| 54 | 57 | private function getBodyParametersFromDocBlock($tags) |
| 55 | 58 | { |
| 56 | 59 | $parameters = collect($tags) |
@@ -54,10 +54,10 @@ discard block |
||
| 54 | 54 | private function getBodyParametersFromDocBlock($tags) |
| 55 | 55 | { |
| 56 | 56 | $parameters = collect($tags) |
| 57 | - ->filter(function ($tag) { |
|
| 57 | + ->filter(function($tag) { |
|
| 58 | 58 | return $tag instanceof Tag && $tag->getName() === 'bodyParam'; |
| 59 | 59 | }) |
| 60 | - ->mapWithKeys(function (Tag $tag) { |
|
| 60 | + ->mapWithKeys(function(Tag $tag) { |
|
| 61 | 61 | // Format: |
| 62 | 62 | // @bodyParam <name> <type> <"required" (optional)> <description> |
| 63 | 63 | // Examples: |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $type = $this->normalizeParameterType($type); |
| 84 | 84 | list($description, $example) = $this->parseParamDescription($description, $type); |
| 85 | - $value = is_null($example) && ! $this->shouldExcludeExample($tag->getContent()) |
|
| 85 | + $value = is_null($example) && !$this->shouldExcludeExample($tag->getContent()) |
|
| 86 | 86 | ? $this->generateDummyValue($type) |
| 87 | 87 | : $example; |
| 88 | 88 | |
@@ -52,6 +52,9 @@ |
||
| 52 | 52 | return $this->getQueryParametersFromDocBlock($methodDocBlock->getTags()); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | + /** |
|
| 56 | + * @param Tag[] $tags |
|
| 57 | + */ |
|
| 55 | 58 | private function getQueryParametersFromDocBlock($tags) |
| 56 | 59 | { |
| 57 | 60 | $parameters = collect($tags) |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | private function getQueryParametersFromDocBlock($tags) |
| 56 | 56 | { |
| 57 | 57 | $parameters = collect($tags) |
| 58 | - ->filter(function ($tag) { |
|
| 58 | + ->filter(function($tag) { |
|
| 59 | 59 | return $tag instanceof Tag && $tag->getName() === 'queryParam'; |
| 60 | 60 | }) |
| 61 | - ->mapWithKeys(function (Tag $tag) { |
|
| 61 | + ->mapWithKeys(function(Tag $tag) { |
|
| 62 | 62 | // Format: |
| 63 | 63 | // @queryParam <name> <"required" (optional)> <description> |
| 64 | 64 | // Examples: |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | list($description, $value) = $this->parseParamDescription($description, 'string'); |
| 85 | - if (is_null($value) && ! $this->shouldExcludeExample($tag->getContent())) { |
|
| 85 | + if (is_null($value) && !$this->shouldExcludeExample($tag->getContent())) { |
|
| 86 | 86 | $value = Str::contains($description, ['number', 'count', 'page']) |
| 87 | 87 | ? $this->generateDummyValue('integer') |
| 88 | 88 | : $this->generateDummyValue('string'); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * Get a response from the transformer tags. |
| 50 | 50 | * |
| 51 | - * @param array $tags |
|
| 51 | + * @param Tag[] $tags |
|
| 52 | 52 | * |
| 53 | 53 | * @return array|null |
| 54 | 54 | */ |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | /** |
| 142 | 142 | * @param string $type |
| 143 | 143 | * |
| 144 | - * @return Model|object |
|
| 144 | + * @return string |
|
| 145 | 145 | */ |
| 146 | 146 | protected function instantiateApiResourceModel(string $type) |
| 147 | 147 | { |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | use Mpociot\Reflection\DocBlock; |
| 15 | 15 | use Mpociot\Reflection\DocBlock\Tag; |
| 16 | 16 | use Illuminate\Database\Eloquent\Model; |
| 17 | -use League\Fractal\Resource\Collection; |
|
| 18 | 17 | use Mpociot\ApiDoc\Extracting\RouteDocBlocker; |
| 19 | 18 | use Illuminate\Http\Resources\Json\JsonResource; |
| 20 | 19 | use Mpociot\ApiDoc\Extracting\Strategies\Strategy; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | ], |
| 93 | 93 | ]; |
| 94 | 94 | } catch (\Exception $e) { |
| 95 | - echo 'Exception thrown when fetching Eloquent API resource response for ['.implode(',', $route->methods)."] {$route->uri}.\n"; |
|
| 95 | + echo 'Exception thrown when fetching Eloquent API resource response for [' . implode(',', $route->methods) . "] {$route->uri}.\n"; |
|
| 96 | 96 | if (Flags::$shouldBeVerbose) { |
| 97 | 97 | Utils::dumpException($e); |
| 98 | 98 | } else { |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | private function getClassToBeTransformed(array $tags): string |
| 127 | 127 | { |
| 128 | - $modelTag = Arr::first(array_filter($tags, function ($tag) { |
|
| 128 | + $modelTag = Arr::first(array_filter($tags, function($tag) { |
|
| 129 | 129 | return ($tag instanceof Tag) && strtolower($tag->getName()) == 'apiresourcemodel'; |
| 130 | 130 | })); |
| 131 | 131 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | private function getApiResourceTag(array $tags) |
| 187 | 187 | { |
| 188 | 188 | $apiResourceTags = array_values( |
| 189 | - array_filter($tags, function ($tag) { |
|
| 189 | + array_filter($tags, function($tag) { |
|
| 190 | 190 | return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['apiresource', 'apiresourcecollection']); |
| 191 | 191 | }) |
| 192 | 192 | ); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * Get a response from the transformer tags. |
| 48 | 48 | * |
| 49 | - * @param array $tags |
|
| 49 | + * @param Tag[] $tags |
|
| 50 | 50 | * |
| 51 | 51 | * @return array|null |
| 52 | 52 | */ |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | /** |
| 142 | 142 | * @param string $type |
| 143 | 143 | * |
| 144 | - * @return Model|object |
|
| 144 | + * @return string |
|
| 145 | 145 | */ |
| 146 | 146 | protected function instantiateTransformerModel(string $type) |
| 147 | 147 | { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $fractal = new Manager(); |
| 65 | 65 | |
| 66 | - if (! is_null(config('apidoc.fractal.serializer'))) { |
|
| 66 | + if (!is_null(config('apidoc.fractal.serializer'))) { |
|
| 67 | 67 | $fractal->setSerializer(app(config('apidoc.fractal.serializer'))); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | ], |
| 83 | 83 | ]; |
| 84 | 84 | } catch (\Exception $e) { |
| 85 | - echo 'Exception thrown when fetching transformer response for ['.implode(',', $route->methods)."] {$route->uri}.\n"; |
|
| 85 | + echo 'Exception thrown when fetching transformer response for [' . implode(',', $route->methods) . "] {$route->uri}.\n"; |
|
| 86 | 86 | if (Flags::$shouldBeVerbose) { |
| 87 | 87 | Utils::dumpException($e); |
| 88 | 88 | } else { |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | private function getClassToBeTransformed(array $tags, ReflectionMethod $transformerMethod): string |
| 118 | 118 | { |
| 119 | - $modelTag = Arr::first(array_filter($tags, function ($tag) { |
|
| 119 | + $modelTag = Arr::first(array_filter($tags, function($tag) { |
|
| 120 | 120 | return ($tag instanceof Tag) && strtolower($tag->getName()) == 'transformermodel'; |
| 121 | 121 | })); |
| 122 | 122 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $type = $modelTag->getContent(); |
| 126 | 126 | } else { |
| 127 | 127 | $parameter = Arr::first($transformerMethod->getParameters()); |
| 128 | - if ($parameter->hasType() && ! $parameter->getType()->isBuiltin() && class_exists((string) $parameter->getType())) { |
|
| 128 | + if ($parameter->hasType() && !$parameter->getType()->isBuiltin() && class_exists((string) $parameter->getType())) { |
|
| 129 | 129 | // Ladies and gentlemen, we have a type! |
| 130 | 130 | $type = (string) $parameter->getType(); |
| 131 | 131 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | private function getTransformerTag(array $tags) |
| 187 | 187 | { |
| 188 | 188 | $transformerTags = array_values( |
| 189 | - array_filter($tags, function ($tag) { |
|
| 189 | + array_filter($tags, function($tag) { |
|
| 190 | 190 | return ($tag instanceof Tag) && in_array(strtolower($tag->getName()), ['transformer', 'transformercollection']); |
| 191 | 191 | }) |
| 192 | 192 | ); |
@@ -52,6 +52,9 @@ |
||
| 52 | 52 | return $this->getUrlParametersFromDocBlock($methodDocBlock->getTags()); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | + /** |
|
| 56 | + * @param Tag[] $tags |
|
| 57 | + */ |
|
| 55 | 58 | private function getUrlParametersFromDocBlock($tags) |
| 56 | 59 | { |
| 57 | 60 | $parameters = collect($tags) |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | private function getUrlParametersFromDocBlock($tags) |
| 56 | 56 | { |
| 57 | 57 | $parameters = collect($tags) |
| 58 | - ->filter(function ($tag) { |
|
| 58 | + ->filter(function($tag) { |
|
| 59 | 59 | return $tag instanceof Tag && $tag->getName() === 'urlParam'; |
| 60 | 60 | }) |
| 61 | - ->mapWithKeys(function (Tag $tag) { |
|
| 61 | + ->mapWithKeys(function(Tag $tag) { |
|
| 62 | 62 | // Format: |
| 63 | 63 | // @urlParam <name> <"required" (optional)> <description> |
| 64 | 64 | // Examples: |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | list($description, $value) = $this->parseParamDescription($description, 'string'); |
| 85 | - if (is_null($value) && ! $this->shouldExcludeExample($tag->getContent())) { |
|
| 85 | + if (is_null($value) && !$this->shouldExcludeExample($tag->getContent())) { |
|
| 86 | 86 | $value = Str::contains($description, ['number', 'count', 'page']) |
| 87 | 87 | ? $this->generateDummyValue('integer') |
| 88 | 88 | : $this->generateDummyValue('string'); |
@@ -40,32 +40,32 @@ discard block |
||
| 40 | 40 | $collection = [ |
| 41 | 41 | 'variables' => [], |
| 42 | 42 | 'info' => [ |
| 43 | - 'name' => config('apidoc.postman.name') ?: config('app.name').' API', |
|
| 43 | + 'name' => config('apidoc.postman.name') ?: config('app.name') . ' API', |
|
| 44 | 44 | '_postman_id' => Uuid::uuid4()->toString(), |
| 45 | 45 | 'description' => config('apidoc.postman.description') ?: '', |
| 46 | 46 | 'schema' => 'https://schema.getpostman.com/json/collection/v2.0.0/collection.json', |
| 47 | 47 | ], |
| 48 | - 'item' => $this->routeGroups->map(function ($routes, $groupName) { |
|
| 48 | + 'item' => $this->routeGroups->map(function($routes, $groupName) { |
|
| 49 | 49 | return [ |
| 50 | 50 | 'name' => $groupName, |
| 51 | 51 | 'description' => '', |
| 52 | - 'item' => $routes->map(function ($route) { |
|
| 52 | + 'item' => $routes->map(function($route) { |
|
| 53 | 53 | $mode = $route['methods'][0] === 'PUT' ? 'urlencoded' : 'formdata'; |
| 54 | 54 | |
| 55 | 55 | return [ |
| 56 | 56 | 'name' => $route['metadata']['title'] != '' ? $route['metadata']['title'] : url($route['uri']), |
| 57 | 57 | 'request' => [ |
| 58 | - 'url' => url($route['uri']).(collect($route['queryParameters'])->isEmpty() |
|
| 58 | + 'url' => url($route['uri']) . (collect($route['queryParameters'])->isEmpty() |
|
| 59 | 59 | ? '' |
| 60 | - : ('?'.implode('&', collect($route['queryParameters'])->map(function ($parameter, $key) { |
|
| 61 | - return urlencode($key).'='.urlencode($parameter['value'] ?? ''); |
|
| 60 | + : ('?' . implode('&', collect($route['queryParameters'])->map(function($parameter, $key) { |
|
| 61 | + return urlencode($key) . '=' . urlencode($parameter['value'] ?? ''); |
|
| 62 | 62 | })->all()))), |
| 63 | 63 | 'method' => $route['methods'][0], |
| 64 | 64 | 'header' => collect($route['headers']) |
| 65 | 65 | ->union([ |
| 66 | 66 | 'Accept' => 'application/json', |
| 67 | 67 | ]) |
| 68 | - ->map(function ($value, $header) { |
|
| 68 | + ->map(function($value, $header) { |
|
| 69 | 69 | return [ |
| 70 | 70 | 'key' => $header, |
| 71 | 71 | 'value' => $value, |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ->values()->all(), |
| 75 | 75 | 'body' => [ |
| 76 | 76 | 'mode' => $mode, |
| 77 | - $mode => collect($route['bodyParameters'])->map(function ($parameter, $key) { |
|
| 77 | + $mode => collect($route['bodyParameters'])->map(function($parameter, $key) { |
|
| 78 | 78 | return [ |
| 79 | 79 | 'key' => $key, |
| 80 | 80 | 'value' => $parameter['value'] ?? '', |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function writeMarkdownAndSourceFiles(Collection $parsedRoutes, string $sourceOutputPath) |
| 85 | 85 | { |
| 86 | - $targetFile = $sourceOutputPath.'/source/index.md'; |
|
| 87 | - $compareFile = $sourceOutputPath.'/source/.compare.md'; |
|
| 86 | + $targetFile = $sourceOutputPath . '/source/index.md'; |
|
| 87 | + $compareFile = $sourceOutputPath . '/source/.compare.md'; |
|
| 88 | 88 | |
| 89 | 89 | $infoText = view('apidoc::partials.info') |
| 90 | 90 | ->with('outputPath', 'docs') |
@@ -106,16 +106,16 @@ discard block |
||
| 106 | 106 | $generatedDocumentation = file_get_contents($targetFile); |
| 107 | 107 | $compareDocumentation = file_get_contents($compareFile); |
| 108 | 108 | |
| 109 | - $parsedRouteOutput->transform(function (Collection $routeGroup) use ($generatedDocumentation, $compareDocumentation) { |
|
| 110 | - return $routeGroup->transform(function (array $route) use ($generatedDocumentation, $compareDocumentation) { |
|
| 111 | - if (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $generatedDocumentation, $existingRouteDoc)) { |
|
| 112 | - $routeDocumentationChanged = (preg_match('/<!-- START_'.$route['id'].' -->(.*)<!-- END_'.$route['id'].' -->/is', $compareDocumentation, $lastDocWeGeneratedForThisRoute) && $lastDocWeGeneratedForThisRoute[1] !== $existingRouteDoc[1]); |
|
| 109 | + $parsedRouteOutput->transform(function(Collection $routeGroup) use ($generatedDocumentation, $compareDocumentation) { |
|
| 110 | + return $routeGroup->transform(function(array $route) use ($generatedDocumentation, $compareDocumentation) { |
|
| 111 | + if (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $generatedDocumentation, $existingRouteDoc)) { |
|
| 112 | + $routeDocumentationChanged = (preg_match('/<!-- START_' . $route['id'] . ' -->(.*)<!-- END_' . $route['id'] . ' -->/is', $compareDocumentation, $lastDocWeGeneratedForThisRoute) && $lastDocWeGeneratedForThisRoute[1] !== $existingRouteDoc[1]); |
|
| 113 | 113 | if ($routeDocumentationChanged === false || $this->forceIt) { |
| 114 | 114 | if ($routeDocumentationChanged) { |
| 115 | - $this->output->warn('Discarded manual changes for route ['.implode(',', $route['methods']).'] '.$route['uri']); |
|
| 115 | + $this->output->warn('Discarded manual changes for route [' . implode(',', $route['methods']) . '] ' . $route['uri']); |
|
| 116 | 116 | } |
| 117 | 117 | } else { |
| 118 | - $this->output->warn('Skipping modified route ['.implode(',', $route['methods']).'] '.$route['uri']); |
|
| 118 | + $this->output->warn('Skipping modified route [' . implode(',', $route['methods']) . '] ' . $route['uri']); |
|
| 119 | 119 | $route['modified_output'] = $existingRouteDoc[0]; |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | ->with('showPostmanCollectionButton', $this->shouldGeneratePostmanCollection) |
| 139 | 139 | ->with('parsedRoutes', $parsedRouteOutput); |
| 140 | 140 | |
| 141 | - $this->output->info('Writing index.md and source files to: '.$sourceOutputPath); |
|
| 141 | + $this->output->info('Writing index.md and source files to: ' . $sourceOutputPath); |
|
| 142 | 142 | |
| 143 | - if (! is_dir($sourceOutputPath)) { |
|
| 143 | + if (!is_dir($sourceOutputPath)) { |
|
| 144 | 144 | $documentarian = new Documentarian(); |
| 145 | 145 | $documentarian->create($sourceOutputPath); |
| 146 | 146 | } |
@@ -161,14 +161,14 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | file_put_contents($compareFile, $compareMarkdown); |
| 163 | 163 | |
| 164 | - $this->output->info('Wrote index.md and source files to: '.$sourceOutputPath); |
|
| 164 | + $this->output->info('Wrote index.md and source files to: ' . $sourceOutputPath); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | public function generateMarkdownOutputForEachRoute(Collection $parsedRoutes, array $settings): Collection |
| 168 | 168 | { |
| 169 | - $parsedRouteOutput = $parsedRoutes->map(function (Collection $routeGroup) use ($settings) { |
|
| 170 | - return $routeGroup->map(function (array $route) use ($settings) { |
|
| 171 | - if (count($route['cleanBodyParameters']) && ! isset($route['headers']['Content-Type'])) { |
|
| 169 | + $parsedRouteOutput = $parsedRoutes->map(function(Collection $routeGroup) use ($settings) { |
|
| 170 | + return $routeGroup->map(function(array $route) use ($settings) { |
|
| 171 | + if (count($route['cleanBodyParameters']) && !isset($route['headers']['Content-Type'])) { |
|
| 172 | 172 | // Set content type if the user forgot to set it |
| 173 | 173 | $route['headers']['Content-Type'] = 'application/json'; |
| 174 | 174 | } |
@@ -224,9 +224,9 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | protected function getMarkdownToPrepend(string $sourceOutputPath): string |
| 226 | 226 | { |
| 227 | - $prependFile = $sourceOutputPath.'/source/prepend.md'; |
|
| 227 | + $prependFile = $sourceOutputPath . '/source/prepend.md'; |
|
| 228 | 228 | $prependFileContents = file_exists($prependFile) |
| 229 | - ? file_get_contents($prependFile)."\n" : ''; |
|
| 229 | + ? file_get_contents($prependFile) . "\n" : ''; |
|
| 230 | 230 | |
| 231 | 231 | return $prependFileContents; |
| 232 | 232 | } |
@@ -238,9 +238,9 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | protected function getMarkdownToAppend(string $sourceOutputPath): string |
| 240 | 240 | { |
| 241 | - $appendFile = $sourceOutputPath.'/source/append.md'; |
|
| 241 | + $appendFile = $sourceOutputPath . '/source/append.md'; |
|
| 242 | 242 | $appendFileContents = file_exists($appendFile) |
| 243 | - ? "\n".file_get_contents($appendFile) : ''; |
|
| 243 | + ? "\n" . file_get_contents($appendFile) : ''; |
|
| 244 | 244 | |
| 245 | 245 | return $appendFileContents; |
| 246 | 246 | } |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | protected function copyAssetsFromSourceFolderToPublicFolder(string $sourceOutputPath, bool $isStatic = true): void |
| 249 | 249 | { |
| 250 | 250 | $publicPath = 'public/docs'; |
| 251 | - if (! is_dir($publicPath)) { |
|
| 251 | + if (!is_dir($publicPath)) { |
|
| 252 | 252 | mkdir($publicPath, 0777, true); |
| 253 | 253 | mkdir("{$publicPath}/css"); |
| 254 | 254 | mkdir("{$publicPath}/js"); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | rename("{$sourceOutputPath}/index.html", "{$outputPath}/index.html"); |
| 272 | 272 | } else { |
| 273 | 273 | // Move output to resources/views |
| 274 | - if (! is_dir($outputPath)) { |
|
| 274 | + if (!is_dir($outputPath)) { |
|
| 275 | 275 | mkdir($outputPath); |
| 276 | 276 | } |
| 277 | 277 | rename("{$sourceOutputPath}/index.html", "$outputPath/index.blade.php"); |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | private function getAllRoutes(bool $usingDingoRouter) |
| 66 | 66 | { |
| 67 | - if (! $usingDingoRouter) { |
|
| 67 | + if (!$usingDingoRouter) { |
|
| 68 | 68 | return RouteFacade::getRoutes(); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $allRouteCollections = app(\Dingo\Api\Routing\Router::class)->getRoutes(); |
| 72 | 72 | |
| 73 | 73 | return collect($allRouteCollections) |
| 74 | - ->flatMap(function (RouteCollection $collection) { |
|
| 74 | + ->flatMap(function(RouteCollection $collection) { |
|
| 75 | 75 | return $collection->getRoutes(); |
| 76 | 76 | })->toArray(); |
| 77 | 77 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | private function shouldIncludeRoute(Route $route, array $routeRule, array $mustIncludes, bool $usingDingoRouter) |
| 80 | 80 | { |
| 81 | 81 | $matchesVersion = $usingDingoRouter |
| 82 | - ? ! empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? [])) |
|
| 82 | + ? !empty(array_intersect($route->versions(), $routeRule['match']['versions'] ?? [])) |
|
| 83 | 83 | : true; |
| 84 | 84 | |
| 85 | 85 | return Str::is($mustIncludes, $route->getName()) |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $method = $controller->getMethod($methodName); |
| 57 | 57 | |
| 58 | 58 | $parsedRoute = [ |
| 59 | - 'id' => md5($this->getUri($route).':'.implode($this->getMethods($route))), |
|
| 59 | + 'id' => md5($this->getUri($route) . ':' . implode($this->getMethods($route))), |
|
| 60 | 60 | 'methods' => $this->getMethods($route), |
| 61 | 61 | 'uri' => $this->getUri($route), |
| 62 | 62 | ]; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $responses = $this->fetchResponses($controller, $method, $route, $routeRules, $parsedRoute); |
| 80 | 80 | $parsedRoute['responses'] = $responses; |
| 81 | - $parsedRoute['showresponse'] = ! empty($responses); |
|
| 81 | + $parsedRoute['showresponse'] = !empty($responses); |
|
| 82 | 82 | |
| 83 | 83 | $parsedRoute['headers'] = $routeRules['headers'] ?? []; |
| 84 | 84 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | $responses = $this->iterateThroughStrategies('responses', $context, [$route, $controller, $method, $rulesToApply]); |
| 119 | 119 | if (count($responses)) { |
| 120 | - return array_filter($responses, function ($response) { |
|
| 120 | + return array_filter($responses, function($response) { |
|
| 121 | 121 | return $response['content'] != null; |
| 122 | 122 | }); |
| 123 | 123 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $strategyArgs = $arguments; |
| 158 | 158 | $strategyArgs[] = $context; |
| 159 | 159 | $results = $strategy(...$strategyArgs); |
| 160 | - if (! is_null($results)) { |
|
| 160 | + if (!is_null($results)) { |
|
| 161 | 161 | foreach ($results as $index => $item) { |
| 162 | 162 | if ($stage == 'responses') { |
| 163 | 163 | // Responses are additive |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | // and also allows values to be overwritten |
| 170 | 170 | |
| 171 | 171 | // Don't allow overwriting if an empty value is trying to replace a set one |
| 172 | - if (! in_array($context[$stage], [null, ''], true) && in_array($item, [null, ''], true)) { |
|
| 172 | + if (!in_array($context[$stage], [null, ''], true) && in_array($item, [null, ''], true)) { |
|
| 173 | 173 | continue; |
| 174 | 174 | } else { |
| 175 | 175 | $context[$stage][$index] = $item; |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | $values = []; |
| 195 | 195 | |
| 196 | 196 | // Remove params which have no examples. |
| 197 | - $params = array_filter($params, function ($details) { |
|
| 198 | - return ! is_null($details['value']); |
|
| 197 | + $params = array_filter($params, function($details) { |
|
| 198 | + return !is_null($details['value']); |
|
| 199 | 199 | }); |
| 200 | 200 | |
| 201 | 201 | foreach ($params as $paramName => $details) { |