diff --git a/src/Router.php b/src/Router.php index 4455326..871a96b 100644 --- a/src/Router.php +++ b/src/Router.php @@ -197,9 +197,6 @@ class Router $scanner->parse('App'); $this->read_dir_file(APP_PATH . 'routes'); - - $router = Kiri::getDi()->get(DataGrip::class)->get(ROUTER_TYPE_HTTP); - $router->reset(); } diff --git a/src/RouterCollector.php b/src/RouterCollector.php index 17983fc..4bc6299 100644 --- a/src/RouterCollector.php +++ b/src/RouterCollector.php @@ -39,25 +39,6 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate */ private array $methods = []; - /** - * @return void - * @throws ReflectionException - */ - public function reset(): void - { - $middlewareManager = \Kiri::getDi()->get(MiddlewareManager::class); - - /** - * @var string $method - * @var HashMap $handlers - */ - foreach ($this->methods as $method => $handler) { - $middleware = $middlewareManager->get($handler->getClass(), $handler->getMethod()); - - $this->methods[$method] = new HttpRequestHandler($middleware, $handler); - } - } - /** * @return array @@ -209,14 +190,14 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate * @return Handler|null * @throws ReflectionException */ - public function query(string $path, string $method): ?HttpRequestHandler + public function query(string $path, string $method): ?Handler { if ($method === 'OPTIONS') { $path = '/*'; } $parent = $this->methods[$method . '_' . $path] ?? null; if ($parent === null) { - return new HttpRequestHandler([], new Handler([di(NotFoundController::class), 'fail'], [])); + return new Handler([di(NotFoundController::class), 'fail'], []); } return $parent; }