Skip to content

Commit 7290c26

Browse files
authored
Merge pull request #745 from ScopeyNZ/feature/hide-controllers-from-docs
@hideFromAPIDocumentation can now be applied to controllers
2 parents f92ea02 + ef96db8 commit 7290c26

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/Commands/GenerateDocumentation.php

+12-10
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,20 @@ private function isRouteVisibleForDocumentation(array $routeControllerAndMethod)
187187
[$class, $method] = $routeControllerAndMethod;
188188
$reflection = new ReflectionClass($class);
189189

190-
$comment = $reflection->getMethod($method)->getDocComment();
191-
192-
if ($comment) {
190+
$tags = collect();
191+
192+
foreach (
193+
array_filter([
194+
$reflection->getDocComment(),
195+
$reflection->getMethod($method)->getDocComment()
196+
]) as $comment
197+
) {
193198
$phpdoc = new DocBlock($comment);
194-
195-
return collect($phpdoc->getTags())
196-
->filter(function ($tag) {
197-
return $tag->getName() === 'hideFromAPIDocumentation';
198-
})
199-
->isEmpty();
199+
$tags = $tags->concat($phpdoc->getTags());
200200
}
201201

202-
return true;
202+
return $tags->filter(function ($tag) {
203+
return $tag->getName() === 'hideFromAPIDocumentation';
204+
})->isEmpty();
203205
}
204206
}

0 commit comments

Comments
 (0)