diff options
| author | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:32 +0100 |
|---|---|---|
| committer | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:32 +0100 |
| commit | 6ad39e3ba64e518bcdba1fc32b6247375be39a8a (patch) | |
| tree | cc7ba7901043428b327d454580460e7b67c399b9 /src/Group.php | |
| parent | 9e6a18235564df5046c40570a864bcbd5c8bcf62 (diff) | |
shared code in traits for common features for groups
Diffstat (limited to 'src/Group.php')
| -rw-r--r-- | src/Group.php | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/Group.php b/src/Group.php new file mode 100644 index 0000000..4e6c71e --- /dev/null +++ b/src/Group.php @@ -0,0 +1,65 @@ +<?php + +declare(strict_types=1); + +namespace Lightscale\Router; + +class Group +{ + use Concerns\HasAncestors; + + public function __construct( + private Router $router, + private ?Group $parent, + private ?string $prefix = null, + private ?string $name = null, + ) { + } + + public function getRouter(): Router + { + return $this->router; + } + + public function getParent(): ?static + { + return $this->parent; + } + + public function prefix(string $value): static + { + $this->prefix = $value; + + return $this; + } + + public function getPrefix(): ?string + { + return $this->prefix; + } + + public function getPath(): string + { + + } + + public function name(string $value): static + { + $this->name = $value; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + /** @param callable(self): void $cb */ + public function group(callable $cb): void + { + ($cb)(new GroupDefinition( + $this + )); + } +} |
