- Breadcrumb now shows up only if deep within at least two routes (if ignoreSoleRoute is true)
This commit is contained in:
parent
34a3351ed5
commit
81fa3d49c7
|
@ -99,6 +99,8 @@ class AnnotationReader
|
|||
case $reflect instanceof ReflectionClass :
|
||||
return $reflect->name;
|
||||
}
|
||||
|
||||
return "#UNKNOWN#";
|
||||
}
|
||||
|
||||
protected function getObjectNamespace(Reflector $reflect) : string
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ class ObjectReflection {
|
|||
$this->cache = $cache;
|
||||
|
||||
#if ( ! $this->cache || ! $this->cache->has($class) ) {
|
||||
$this->classReflection = $class instanceof ReflectionClass ? $class : new ReflectionClass($class);
|
||||
# }
|
||||
$this->classReflection = $class instanceof ReflectionClass ? $class : new ReflectionClass($class);
|
||||
# }
|
||||
}
|
||||
|
||||
public static function fromClass(ReflectionClass|string $class, ? CacheInterface $cache = null) : self
|
||||
|
@ -53,11 +53,11 @@ class ObjectReflection {
|
|||
traits: array_map(fn($trait) => static::fromClass($trait)->reflectClass(), array_keys($this->classReflection->getTraits())),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function reflectProperties(int $filter =
|
||||
ReflectionProperty::IS_PUBLIC |
|
||||
ReflectionProperty::IS_PROTECTED |
|
||||
ReflectionProperty::IS_PRIVATE
|
||||
ReflectionProperty::IS_PUBLIC |
|
||||
ReflectionProperty::IS_PROTECTED |
|
||||
ReflectionProperty::IS_PRIVATE
|
||||
) : array
|
||||
{
|
||||
$defaultValues = $this->classReflection->getDefaultProperties();
|
||||
|
@ -87,11 +87,11 @@ class ObjectReflection {
|
|||
}
|
||||
|
||||
public function reflectMethods(int $filter =
|
||||
ReflectionMethod::IS_PUBLIC |
|
||||
ReflectionMethod::IS_PROTECTED |
|
||||
ReflectionMethod::IS_PRIVATE |
|
||||
ReflectionMethod::IS_STATIC |
|
||||
ReflectionMethod::IS_FINAL
|
||||
ReflectionMethod::IS_PUBLIC |
|
||||
ReflectionMethod::IS_PROTECTED |
|
||||
ReflectionMethod::IS_PRIVATE |
|
||||
ReflectionMethod::IS_STATIC |
|
||||
ReflectionMethod::IS_FINAL
|
||||
) : array
|
||||
{
|
||||
$list = [];
|
||||
|
|
Loading…
Reference in New Issue