modify plugin name

This commit is contained in:
2022-06-20 17:31:04 +08:00
parent 005b33c9d6
commit b0b7906135
4 changed files with 18 additions and 11 deletions
+8 -4
View File
@@ -5,9 +5,7 @@ namespace Kiri\Server\Abstracts;
use Kiri\Abstracts\Config;
use Kiri\Di\ContainerInterface;
use Kiri\Events\EventDispatch;
use Kiri\Exception\ConfigException;
use Kiri\Server\Constant;
use Kiri\Server\Events\OnShutdown;
use Kiri\Server\Events\OnWorkerStart;
use Kiri\Server\Events\OnWorkerStop;
use Kiri\Server\ServerInterface;
@@ -55,10 +53,16 @@ class CoroutineServer implements ServerInterface
/**
* @param string $name
* @return Server|\Swoole\Coroutine\Server|\Swoole\Coroutine\Http\Server|null
* @return Server|Coroutine\Server|Coroutine\Http\Server|null
*/
public function getServer(string $name): Server|\Swoole\Coroutine\Server|\Swoole\Coroutine\Http\Server|null
public function getServer(string $name = ''): Server|Coroutine\Server|Coroutine\Http\Server|null
{
if (empty($this->servers)) {
return null;
}
if (empty($name)) {
return current($this->servers);
}
return $this->servers[$name] ?? null;
}
+5 -3
View File
@@ -16,12 +16,14 @@ trait TraitServer
/**
* @param $class
* @param array $class
* @return void
*/
public function addProcess($class): void
public function addProcess(array $class): void
{
$this->_process[] = $class;
foreach ($class as $key => $item) {
$this->_process[] = $item;
}
}