summaryrefslogtreecommitdiff
path: root/src/Router.php
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/Router.php
parent3ccbdb7afd95972fbfdb797601acaedd467663a4 (diff)
fixing tests and code formatting
Diffstat (limited to 'src/Router.php')
-rw-r--r--src/Router.php7
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;
}