改名
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Annotation;
|
|||||||
|
|
||||||
|
|
||||||
use ReflectionAttribute;
|
use ReflectionAttribute;
|
||||||
|
use ReflectionClass;
|
||||||
use ReflectionException;
|
use ReflectionException;
|
||||||
use Snowflake\Abstracts\Component;
|
use Snowflake\Abstracts\Component;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
@@ -116,9 +117,9 @@ class Annotation extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \ReflectionClass $reflect
|
* @param ReflectionClass $reflect
|
||||||
*/
|
*/
|
||||||
private function targets(\ReflectionClass $reflect)
|
private function targets(ReflectionClass $reflect)
|
||||||
{
|
{
|
||||||
$attributes = $reflect->getAttributes();
|
$attributes = $reflect->getAttributes();
|
||||||
if (count($attributes) < 1) {
|
if (count($attributes) < 1) {
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
namespace Annotation;
|
namespace Annotation;
|
||||||
|
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use HttpServer\Route\Node;
|
||||||
|
use Snowflake\Exception\ComponentException;
|
||||||
|
use Snowflake\Snowflake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Socket
|
* Class Socket
|
||||||
* @package Annotation
|
* @package Annotation
|
||||||
@@ -28,4 +33,20 @@ namespace Annotation;
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Closure|array $closure
|
||||||
|
* @return mixed
|
||||||
|
* @throws ComponentException
|
||||||
|
*/
|
||||||
|
public function setHandler(Closure|array $closure): mixed
|
||||||
|
{
|
||||||
|
$router = Snowflake::app()->getRouter();
|
||||||
|
// TODO: Implement setHandler() method.
|
||||||
|
|
||||||
|
$method = $this->event . '::' . ($this->uri ?? 'event');
|
||||||
|
|
||||||
|
return $router->addRoute($method, $closure, 'sw::socket');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user