diff --git a/HttpServer/Route/Router.php b/HttpServer/Route/Router.php index 374a2b52..b7771f59 100644 --- a/HttpServer/Route/Router.php +++ b/HttpServer/Route/Router.php @@ -111,6 +111,11 @@ class Router extends HttpService implements RouterInterface if ($handler instanceof Closure) { $handler = Closure::bind($handler, new Controller()); } + + if ($this->useTree === ROUTER_TREE) { + return $this->tree($path, $handler, $method); + } + return $this->hash($path, $handler, $method); } @@ -511,9 +516,7 @@ class Router extends HttpService implements RouterInterface */ public function find_path(Request $request): ?Node { - if ($this->useTree === ROUTER_TREE) { - return $this->Branch_search($request); - } + return $this->Branch_search($request); $method = $request->getMethod(); $uri = $request->headers->get('request_uri', '/');