| Total Complexity | 6 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | final class RouteKey implements Stringable |
||
| 24 | { |
||
| 25 | protected readonly string $key; |
||
| 26 | |||
| 27 | public static function make(string $key): self |
||
| 28 | { |
||
| 29 | return new self($key); |
||
| 30 | } |
||
| 31 | |||
| 32 | public function __construct(string $key) |
||
| 33 | { |
||
| 34 | $this->key = self::normalize($key); |
||
|
|
|||
| 35 | } |
||
| 36 | |||
| 37 | public function __toString(): string |
||
| 38 | { |
||
| 39 | return $this->key; |
||
| 40 | } |
||
| 41 | |||
| 42 | public function get(): string |
||
| 43 | { |
||
| 44 | return $this->key; |
||
| 45 | } |
||
| 46 | |||
| 47 | public static function normalize(string $string): string |
||
| 48 | { |
||
| 49 | return str_replace('.', '/', $string); |
||
| 50 | } |
||
| 51 | |||
| 52 | /** @param class-string<\Hyde\Pages\Concerns\HydePage> $pageClass */ |
||
| 53 | public static function fromPage(string $pageClass, string $identifier): self |
||
| 56 | } |
||
| 57 | } |
||
| 58 |