From ab0ea0c64918a999c1eef17a60f9ff61cc5ca653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 3 Sep 2020 17:37:53 +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-server/Route/Node.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/http-server/Route/Node.php b/http-server/Route/Node.php index 49f80de3..2b5ec6b9 100644 --- a/http-server/Route/Node.php +++ b/http-server/Route/Node.php @@ -59,7 +59,7 @@ class Node extends Application } else { $this->handler = $handler; } - return $this->newExec(); + return $this->restructure(); } @@ -288,20 +288,21 @@ class Node extends Application return; } $this->middleware = $this->each($middles, $_tmp); - $this->newExec(); + $this->restructure(); } /** * @throws Exception */ - private function newExec() + private function restructure() { - if (!empty($this->handler)) { - $made = new Middleware(); - $made->setMiddleWares($this->middleware); - $made->getGenerate($this); + if (empty($this->handler)) { + return $this; } + $made = Snowflake::createObject(Middleware::class); + $made->setMiddleWares($this->middleware); + $made->getGenerate($this); return $this; }