From b71ffd2b7878174bdcf501a47d4e2648402d801d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 29 Oct 2021 19:00:15 +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 --- src/RpcManager.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/RpcManager.php b/src/RpcManager.php index 072aaf2..8725d15 100644 --- a/src/RpcManager.php +++ b/src/RpcManager.php @@ -23,12 +23,12 @@ class RpcManager $methods = Kiri::getDi()->getReflect($class); $lists = $methods->getMethods(\ReflectionMethod::IS_PUBLIC); - if (!isset(static::$_rpc[$name])) static::$_rpc[$name] = []; + if (!isset(static::$_rpc[$name])) static::$_rpc[$name] = ['methods' => [], 'id' => $serviceId]; foreach ($lists as $reflection) { $methodName = $reflection->getName(); - static::$_rpc[$name][$methodName] = [[$class, $methodName], null, $serviceId]; + static::$_rpc[$name]['methods'][$methodName] = [[$class, $methodName], null]; } return true; } @@ -38,11 +38,7 @@ class RpcManager { $array = []; foreach (static::$_rpc as $list) { - - foreach ($list as $value) { - $array[] = $value[2]; - } - + $array[] = $list['id']; } return $array; } @@ -55,7 +51,7 @@ class RpcManager */ public static function get(string $name, string $method): array { - return static::$_rpc[$name][$method] ?? [null, null, null]; + return static::$_rpc[$name]['methods'][$method] ?? [null, null]; } }