From eda668094adf7907acfc81503099169f9c85be36 Mon Sep 17 00:00:00 2001 From: zyimm Date: Thu, 11 Aug 2022 19:19:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CoreMiddleware.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/CoreMiddleware.php b/src/CoreMiddleware.php index e2a4538..4cd6beb 100644 --- a/src/CoreMiddleware.php +++ b/src/CoreMiddleware.php @@ -9,14 +9,16 @@ declare(strict_types=1); * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ -namespace Hyperf\MqttServer; +namespace Zyimm\MqttServer; use Hyperf\Context\Context; use Hyperf\Di\Annotation\AnnotationCollector; use Hyperf\HttpMessage\Base\Response; use Hyperf\HttpServer\Contract\CoreMiddlewareInterface; use Laminas\Stdlib\SplPriorityQueue; +use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; +use Psr\Container\NotFoundExceptionInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; @@ -31,12 +33,12 @@ class CoreMiddleware implements CoreMiddlewareInterface /** * @var ContainerInterface */ - protected $container; + protected ContainerInterface $container; /** * @var string */ - protected $serverName; + protected string $serverName; public function __construct(ContainerInterface $container, string $serverName) { @@ -49,6 +51,15 @@ class CoreMiddleware implements CoreMiddlewareInterface return $request; } + /** + * process + * + * @param ServerRequestInterface $request + * @param RequestHandlerInterface $handler + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $type = $request->getAttribute(Types::class);