This commit is contained in:
2021-10-28 15:14:21 +08:00
parent 791af89ba9
commit 7e91e227b2
4 changed files with 47 additions and 30 deletions
+6 -4
View File
@@ -3,8 +3,8 @@
namespace Kiri\Rpc\Annotation;
use Annotation\Attribute;
use Http\Handler\Router;
use Kiri\Kiri;
use Kiri\Rpc\RpcManager;
use ReflectionException;
#[\Attribute(\Attribute::TARGET_CLASS)] class JsonRpc extends Attribute
{
@@ -13,6 +13,7 @@ use Kiri\Kiri;
/**
* @param string $method
* @param string $version
* @param string $protocol
*/
public function __construct(public string $method, public string $version = '2.0', public string $protocol = 'json')
{
@@ -24,10 +25,11 @@ use Kiri\Kiri;
* @param mixed $class
* @param mixed|string $method
* @return mixed
* @throws ReflectionException
*/
public function execute(mixed $class, mixed $method = ''): mixed
public function execute(mixed $class, mixed $method = ''): bool
{
return parent::execute($class, $method); // TODO: Change the autogenerated stub
return RpcManager::add($this->method, $class);
}