From 18f541759f8669728d7b49751aae74d0b6aa1a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 19 Apr 2021 14:28:50 +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 --- Annotation/Port.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Annotation/Port.php b/Annotation/Port.php index 6cd1ecc3..beeb0bcb 100644 --- a/Annotation/Port.php +++ b/Annotation/Port.php @@ -4,6 +4,14 @@ namespace Annotation; +use Exception; +use Snowflake\Snowflake; + + +/** + * Class Port + * @package Annotation + */ #[\Attribute(\Attribute::TARGET_METHOD)] class Port extends Attribute { @@ -20,10 +28,13 @@ namespace Annotation; /** * @param array $handler * @return mixed + * @throws Exception */ public function execute(array $handler): mixed { - return parent::execute($handler); // TODO: Change the autogenerated stub + $router = Snowflake::app()->getRouter(); + $router->addPortListen($this->port, $handler); + return parent::execute($handler); } }