fix: 修改文件注释,格式化代码

This commit is contained in:
邹景立 2024-08-08 23:28:08 +08:00
parent 1c70a78c74
commit 6067f9778b
2 changed files with 35 additions and 1 deletions

View File

@ -34,8 +34,21 @@ abstract class Server
protected $port = '2346';
protected $option = [];
protected $context = [];
protected $event = ['onWorkerStart', 'onConnect', 'onMessage', 'onClose', 'onError', 'onBufferFull', 'onBufferDrain', 'onWorkerReload', 'onWebSocketConnect'];
protected $event = [
'onWorkerStart',
'onConnect',
'onMessage',
'onClose',
'onError',
'onBufferFull',
'onBufferDrain',
'onWorkerReload',
'onWebSocketConnect'
];
/**
* 服务构造方法
*/
public function __construct()
{
// 实例化 Websocket 服务
@ -59,13 +72,29 @@ abstract class Server
$this->init();
}
/**
* 服务初始化方法
* @return mixed
*/
abstract protected function init();
/**
* 动态设置属性
* @param string $name
* @param mixed $value
* @return void
*/
public function __set(string $name, $value)
{
$this->worker->$name = $value;
}
/**
* 动态调用方法
* @param string $method
* @param array $args
* @return void
*/
public function __call(string $method, array $args)
{
call_user_func_array([$this->worker, $method], $args);

View File

@ -21,6 +21,11 @@ namespace plugin\worker;
use plugin\worker\command\Worker;
use think\admin\Plugin;
/**
* 插件注册服务
* @class Service
* @package plugin\worker
*/
class Service extends Plugin
{
/**