diff options
| author | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:33 +0100 |
|---|---|---|
| committer | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:33 +0100 |
| commit | 7978144408e0a8d2ec5375831fb2111ef08e4b27 (patch) | |
| tree | 11bddd9b20829411466b2c2fdb27a0edb5b432e4 /src/Router.php | |
| parent | 3ccbdb7afd95972fbfdb797601acaedd467663a4 (diff) | |
fixing tests and code formatting
Diffstat (limited to 'src/Router.php')
| -rw-r--r-- | src/Router.php | 7 |
1 files changed, 5 insertions, 2 deletions
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; } |
