This commit is contained in:
2021-08-19 17:41:10 +08:00
parent 99b4aee754
commit 633d1fce44
3 changed files with 69 additions and 22 deletions
+34 -2
View File
@@ -11,7 +11,6 @@ namespace Kiri;
use Closure;
use Console\CommandInterface;
use Console\Console;
use Console\ConsoleProviders;
use Database\DatabasesProviders;
@@ -28,8 +27,8 @@ use Kiri\Exception\NotFindClassException;
use Kiri\FileListen\FileChangeCustomProcess;
use ReflectionException;
use Server\ResponseInterface;
use Server\ServerManager;
use stdClass;
use Swoole\Process;
use Swoole\Timer;
/**
@@ -51,6 +50,10 @@ class Application extends BaseApplication
public string $state = '';
/** @var array<Process> */
private array $_process = [];
/**
* @throws NotFindClassException
*/
@@ -79,6 +82,35 @@ class Application extends BaseApplication
}
/**
* @param string $class
* @param Process $process
*/
public function addProcess(string $class, Process $process)
{
$this->_process[$class] = $process;
}
/**
* @return Process[]
*/
public function getProcess(): array
{
return $this->_process;
}
/**
* @param string $class
* @return Process|null
*/
public function getProcessName(string $class): ?Process
{
return $this->_process[$class] ?? null;
}
/**
* @throws NotFindClassException
* @throws ReflectionException