- Breadcrumb now shows up only if deep within at least two routes (if ignoreSoleRoute is true)

This commit is contained in:
Dave Mc Nicoll 2024-10-14 12:52:34 +00:00
parent 34a3351ed5
commit 81fa3d49c7
3 changed files with 20 additions and 12 deletions

View File

@ -99,6 +99,8 @@ class AnnotationReader
case $reflect instanceof ReflectionClass :
return $reflect->name;
}
return "#UNKNOWN#";
}
protected function getObjectNamespace(Reflector $reflect) : string

View File

@ -10,6 +10,8 @@ use RuntimeException, DirectoryIterator, Generator;
class Breadcrumb extends RouteFetcher {
public bool $ignoreSoleRoute = true;
public function getRouteTree(\Notes\Route\Attribute\Method\Route $route) : array
{
$tree = [];
@ -36,7 +38,11 @@ class Breadcrumb extends RouteFetcher {
else {
$route = null;
}
};
}
if ($this->ignoreSoleRoute && count($tree) === 1) {
return [];
}
return array_reverse($tree);
}