改名
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Kiri\Rpc\Annotation;
|
||||
|
||||
use Annotation\Attribute;
|
||||
use Kiri\Kiri;
|
||||
use Kiri\Rpc\RpcManager;
|
||||
use ReflectionException;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS)] class RpcProduct extends Attribute
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param string $cmd
|
||||
* @param string $protocol
|
||||
*/
|
||||
public function __construct(public string $cmd, public string $protocol)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $class
|
||||
* @param mixed|string $method
|
||||
* @return mixed
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function execute(mixed $class, mixed $method = ''): mixed
|
||||
{
|
||||
$class = Kiri::getDi()->get($class);
|
||||
|
||||
RpcManager::addCmdHandler($this->cmd, [$class, $method], $this->protocol);
|
||||
|
||||
return parent::execute($class, $method); // TODO: Change the autogenerated stub
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user