From c1552a4c88eca9a2253c1681a178396531ebbf75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 6 Sep 2021 16:04:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http-helper/Route/Router.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/http-helper/Route/Router.php b/http-helper/Route/Router.php index 9c1bfd20..140a2ed6 100644 --- a/http-helper/Route/Router.php +++ b/http-helper/Route/Router.php @@ -32,9 +32,7 @@ class Router extends HttpService implements RouterInterface /** @var Node[] $nodes */ public array $nodes = []; public array $groupTacks = []; - public ?string $dir = 'App\\Http\\Controllers'; - - const NOT_FOUND = 'Page not found or method not allowed.'; + public ?string $namespace = 'App\\Http\\Controllers'; /** @var string[] */ public array $methods = ['GET', 'POST', 'OPTIONS', 'PUT', 'DELETE', 'RECEIVE', 'HEAD']; @@ -70,7 +68,7 @@ class Router extends HttpService implements RouterInterface */ public function init() { - $this->dir = Config::get('http.namespace', $this->dir); + $this->namespace = Config::get('http.namespace', $this->namespace); $this->response = Kiri::app()->get('response'); } @@ -343,7 +341,7 @@ class Router extends HttpService implements RouterInterface private function loadNamespace(): array { $name = array_column($this->groupTacks, 'namespace'); - array_unshift($name, $this->dir); + array_unshift($name, $this->namespace); return array_filter($name); }