From 22deb976505f39da3bf10d4acf1665dc3c7f387d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Sun, 23 Apr 2023 14:22:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Server.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Server.php b/src/Server.php index c7384f1..84d2bf5 100644 --- a/src/Server.php +++ b/src/Server.php @@ -28,6 +28,10 @@ use Kiri\Router\Base\ExceptionHandlerDispatcher; class Server implements OnRequestInterface { + + /** + * @var RouterCollector + */ public RouterCollector $router; @@ -61,15 +65,16 @@ class Server implements OnRequestInterface */ public function init(): void { - $this->emitter = di(HttpResponseEmitter::class); + $container = Kiri::getDi(); + $this->emitter = $container->get(HttpResponseEmitter::class); $exception = $this->request->exception; if (!in_array(ExceptionHandlerInterface::class, class_implements($exception))) { $exception = ExceptionHandlerDispatcher::class; } - $this->exception = di($exception); + $this->exception = $container->get($exception); - $this->router = di(DataGrip::class)->get(ROUTER_TYPE_HTTP); + $this->router = $container->get(DataGrip::class)->get(ROUTER_TYPE_HTTP); }