From dc1b7a9c0b932eb34cecf438f376fa8b23530e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Sat, 20 Feb 2021 16:15:01 +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/Events/OnMessage.php | 4 +++- HttpServer/Http/Request.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/HttpServer/Events/OnMessage.php b/HttpServer/Events/OnMessage.php index 436ffc96..3c543109 100644 --- a/HttpServer/Events/OnMessage.php +++ b/HttpServer/Events/OnMessage.php @@ -7,6 +7,7 @@ namespace HttpServer\Events; use Annotation\Route\Socket; use Exception; use HttpServer\Abstracts\Callback; +use HttpServer\Http\Context; use Snowflake\Event; use Snowflake\Exception\ComponentException; use Snowflake\Snowflake; @@ -63,7 +64,8 @@ class OnMessage extends Callback throw new Exception('Format error.'); } $router = Snowflake::app()->getRouter(); - $node = $router->search('/' . Socket::MESSAGE . '::' . $route, 'sw::socket'); + + $node = $router->tree_search(explode('/', Socket::MESSAGE . '::' . $route), 'sw::socket'); if ($node === null) { throw new Exception('Page not found.'); } diff --git a/HttpServer/Http/Request.php b/HttpServer/Http/Request.php index 3dae28b2..e09fd37e 100644 --- a/HttpServer/Http/Request.php +++ b/HttpServer/Http/Request.php @@ -7,6 +7,7 @@ use Exception; use HttpServer\Application; use HttpServer\IInterface\AuthIdentity; +use JetBrains\PhpStorm\Pure; use ReflectionException; use Snowflake\Core\Json; use Snowflake\Exception\ComponentException; @@ -202,7 +203,7 @@ class Request extends Application /** * @return string */ - public function getCurrent(): string + #[Pure] public function getCurrent(): string { return current($this->explode); }