diff --git a/HttpServer/Route/Router.php b/HttpServer/Route/Router.php index 3cc39f6b..f3bb682f 100644 --- a/HttpServer/Route/Router.php +++ b/HttpServer/Route/Router.php @@ -419,16 +419,10 @@ class Router extends HttpService implements RouterInterface */ public function tree_search(?array $explode, $method): ?Node { - if (empty($explode)) { - return static::$nodes[$method]['/'] ?? null; - } - $first = array_shift($explode); - if (!($parent = static::$nodes[$method][$first] ?? null)) { + if (!isset(static::$nodes[$method])) { return null; } - if (empty($explode)) { - return $parent->findNode('/'); - } + $parent = static::$nodes[$method]['/']; while ($value = array_shift($explode)) { $node = $parent->findNode($value); if (!$node) {