Skip to content

Commit

Permalink
Merge pull request #745 from ScopeyNZ/feature/hide-controllers-from-docs
Browse files Browse the repository at this point in the history
@hideFromAPIDocumentation can now be applied to controllers
  • Loading branch information
shalvah authored May 2, 2020
2 parents f92ea02 + ef96db8 commit 7290c26
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/Commands/GenerateDocumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,20 @@ private function isRouteVisibleForDocumentation(array $routeControllerAndMethod)
[$class, $method] = $routeControllerAndMethod;
$reflection = new ReflectionClass($class);

$comment = $reflection->getMethod($method)->getDocComment();

if ($comment) {
$tags = collect();

foreach (
array_filter([
$reflection->getDocComment(),
$reflection->getMethod($method)->getDocComment()
]) as $comment
) {
$phpdoc = new DocBlock($comment);

return collect($phpdoc->getTags())
->filter(function ($tag) {
return $tag->getName() === 'hideFromAPIDocumentation';
})
->isEmpty();
$tags = $tags->concat($phpdoc->getTags());
}

return true;
return $tags->filter(function ($tag) {
return $tag->getName() === 'hideFromAPIDocumentation';
})->isEmpty();
}
}

0 comments on commit 7290c26

Please sign in to comment.