From e6d51ce85c930495469f5198b062bc7b2ceb8e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 27 Jul 2021 19:17:12 +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 --- HttpServer/Route/Node.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index 29f9e8bd..0c39df4c 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -129,14 +129,15 @@ class Node extends HttpService */ private function createDispatch(): Closure { - $application = $this; + return $this->normalHandler($this, $this->handler); + /** @var Aop $aop */ $aop = Snowflake::app()->get('aop'); if ($this->handler instanceof Closure || !$aop->hasAop($this->handler)) { - return $this->normalHandler($application); + return $this->normalHandler($this); } else { - return $this->aopHandler($aop->getAop($this->handler), $application); + return $this->aopHandler($aop->getAop($this->handler), $this); } } @@ -162,10 +163,10 @@ class Node extends HttpService * @param $application * @return Closure */ - private function normalHandler($application): Closure + private function normalHandler($application, $handler): Closure { - return static function () use ($application) { - return call_user_func($application->handler); + return static function () use ($handler) { + return call_user_func($handler); }; }