From 416410491831df5678ed6e728069786a2844b4ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 20 Jul 2021 11:44:47 +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 --- Server/HTTPServerListener.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Server/HTTPServerListener.php b/Server/HTTPServerListener.php index e3f45229..2c261900 100644 --- a/Server/HTTPServerListener.php +++ b/Server/HTTPServerListener.php @@ -2,6 +2,7 @@ namespace Server; +use Exception; use HttpServer\Route\Router; use ReflectionException; use Snowflake\Exception\NotFindClassException; @@ -24,6 +25,16 @@ class HTTPServerListener extends Abstracts\Server private Router $router; + + /** + * HTTPServerListener constructor. + * @throws Exception + */ + public function __construct() + { + $this->router = Snowflake::getApp('router'); + } + /** * UDPServerListener constructor. * @param Server|\Swoole\WebSocket\Server|\Swoole\Http\Server $server @@ -34,7 +45,7 @@ class HTTPServerListener extends Abstracts\Server * @return Server\Port * @throws NotFindClassException * @throws ReflectionException - * @throws \Exception + * @throws Exception */ public static function instance(mixed $server, string $host, int $port, int $mode, ?array $settings = []): Server\Port {