diff options
Diffstat (limited to 'src/Group.php')
| -rw-r--r-- | src/Group.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Group.php b/src/Group.php index 4e6c71e..c208180 100644 --- a/src/Group.php +++ b/src/Group.php @@ -21,7 +21,7 @@ class Group return $this->router; } - public function getParent(): ?static + public function getParent(): ?self { return $this->parent; } @@ -40,7 +40,16 @@ class Group public function getPath(): string { + $ancestors = $this->getAncestorsAndSelf(); + return '/' . implode('/', array_filter( + array_map(fn(Group $g): ?string => ( + ($v = $g->getPrefix()) === null ? + null : + trim($v, '/') + ), $ancestors), + fn (?string $v) => $v !== null + )); } public function name(string $value): static @@ -55,7 +64,7 @@ class Group return $this->name; } - /** @param callable(self): void $cb */ + /** @param callable(GroupDefinition): void $cb */ public function group(callable $cb): void { ($cb)(new GroupDefinition( |
