summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Light <sam@lightscale.co.uk>2026-06-10 19:00:33 +0100
committerSam Light <sam@lightscale.co.uk>2026-06-10 19:00:33 +0100
commit7978144408e0a8d2ec5375831fb2111ef08e4b27 (patch)
tree11bddd9b20829411466b2c2fdb27a0edb5b432e4 /src
parent3ccbdb7afd95972fbfdb797601acaedd467663a4 (diff)
fixing tests and code formatting
Diffstat (limited to 'src')
-rw-r--r--src/Group.php2
-rw-r--r--src/Router.php7
2 files changed, 6 insertions, 3 deletions
diff --git a/src/Group.php b/src/Group.php
index aba0b82..05fa93b 100644
--- a/src/Group.php
+++ b/src/Group.php
@@ -58,7 +58,7 @@ class Group
$prefixes = $this->getAncestorString(fn ($g) => $g->getPrefix());
$prefixes = array_map(fn (string $p) => trim($p, '/'), $prefixes);
- return count($prefixes) > 0 ? '/'.implode('/', $prefixes): '';
+ return count($prefixes) > 0 ? '/'.implode('/', $prefixes) : '';
}
public function name(string $value): static
diff --git a/src/Router.php b/src/Router.php
index d6b255a..74c4e89 100644
--- a/src/Router.php
+++ b/src/Router.php
@@ -55,8 +55,11 @@ class Router
/** @return string[] */
private function splitPath(string $path): array
{
- $split = explode('/', rtrim($path, '/'));
- array_shift($split);
+ if (in_array($path, ['', '/'], true)) {
+ $split = [];
+ } else {
+ $split = explode('/', trim($path, '/'));
+ }
return $split;
}