改名
This commit is contained in:
@@ -59,7 +59,7 @@ class Annotation extends Component
|
|||||||
* @param string $namespace
|
* @param string $namespace
|
||||||
* @param string $alias
|
* @param string $alias
|
||||||
* @return $this
|
* @return $this
|
||||||
* @throws ReflectionException|NotFindPropertyException
|
* @throws ReflectionException|NotFindPropertyException|NotFindClassException
|
||||||
*/
|
*/
|
||||||
public function readControllers(string $path, string $namespace, string $alias = 'root'): static
|
public function readControllers(string $path, string $namespace, string $alias = 'root'): static
|
||||||
{
|
{
|
||||||
@@ -213,9 +213,6 @@ class Annotation extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
$name = get_class($object) . '_' . $method->getName();
|
$name = get_class($object) . '_' . $method->getName();
|
||||||
if (!isset($this->_annotations[$alias])) {
|
|
||||||
$this->_annotations[$alias] = [];
|
|
||||||
}
|
|
||||||
if (!isset($this->_annotations[$alias][$name])) {
|
if (!isset($this->_annotations[$alias][$name])) {
|
||||||
$this->_annotations[$alias][$name] = [];
|
$this->_annotations[$alias][$name] = [];
|
||||||
}
|
}
|
||||||
@@ -239,9 +236,9 @@ class Annotation extends Component
|
|||||||
* @param $class
|
* @param $class
|
||||||
* @param $method
|
* @param $method
|
||||||
* @param string $alias
|
* @param string $alias
|
||||||
* @return array|mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getAnnotationByMethod($class, $method, $alias = '')
|
public function getAnnotationByMethod($class, $method, $alias = ''): mixed
|
||||||
{
|
{
|
||||||
if (!isset($this->_annotations[$alias])) {
|
if (!isset($this->_annotations[$alias])) {
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
@@ -488,19 +488,6 @@ class Server extends HttpService
|
|||||||
$event->on(Event::SERVER_WORKER_START, function () {
|
$event->on(Event::SERVER_WORKER_START, function () {
|
||||||
$attributes = Snowflake::app()->getAttributes();
|
$attributes = Snowflake::app()->getAttributes();
|
||||||
$attributes->readControllers(SOCKET_PATH, 'App\Websocket', 'sockets');
|
$attributes->readControllers(SOCKET_PATH, 'App\Websocket', 'sockets');
|
||||||
|
|
||||||
$aliases = $attributes->getAlias('sockets');
|
|
||||||
if (count($aliases) < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
foreach ($aliases as $alias) {
|
|
||||||
$handler = $alias['handler'];
|
|
||||||
foreach ($alias['attributes'] as $key => $attribute) {
|
|
||||||
if ($attribute instanceof IAnnotation) {
|
|
||||||
$attribute->execute($handler);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user