Skip to content

Commit

Permalink
Merge pull request #272 from ajcastro/small-refactor-route-docblocker
Browse files Browse the repository at this point in the history
Add getDocBlocks() in RouteDocBlocker
  • Loading branch information
shalvah authored Jul 9, 2021
2 parents 3b579eb + 4b902ed commit 30bd280
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Extracting/RouteDocBlocker.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,24 @@ class RouteDocBlocker
protected static array $docBlocks = [];

/**
* @param Route $route
*
* @throws \ReflectionException
* @throws \Exception
*
* @return array{method: DocBlock, class: DocBlock} Method and class docblocks
*/
public static function getDocBlocksFromRoute(Route $route): array
{
[$className, $methodName] = u::getRouteClassAndMethodNames($route);

return static::getDocBlocks($route, $className, $methodName);
}

/**
* @return array{method: DocBlock, class: DocBlock} Method and class docblocks
*/
public static function getDocBlocks(Route $route, $className, $methodName = null): array
{
if (is_array($className)) {
[$className, $methodName] = $className;
}

$normalizedClassName = static::normalizeClassName($className);
$docBlocks = self::getCachedDocBlock($route, $normalizedClassName, $methodName);

Expand Down

0 comments on commit 30bd280

Please sign in to comment.