modify plugin name

This commit is contained in:
2022-02-14 14:28:47 +08:00
parent f42614ea5d
commit 60e891b08c
2 changed files with 72 additions and 7 deletions
+44 -2
View File
@@ -2,13 +2,55 @@
namespace Kiri\Websocket;
use JetBrains\PhpStorm\Pure;
use Kiri\Annotation\Inject;
use Kiri\Core\HashMap;
use Swoole\Http\Response;
class FdCollector
{
public function set($fd)
{
#[Inject(HashMap::class)]
public HashMap $fds;
/**
* @param int $fd
* @param Response $response
* @return void
*/
public function set(int $fd, Response $response)
{
$this->fds->put('fd_' . $fd, $response);
}
/**
* @param int $fd
* @return bool
*/
#[Pure] public function has(int $fd): bool
{
return $this->fds->has('fd_' . $fd);
}
/**
* @param int $fd
* @return ?Response
*/
#[Pure] public function get(int $fd): ?Response
{
return $this->fds->get('fd_' . $fd);
}
/**
* @param int $fd
* @return void
*/
public function remove(int $fd)
{
$this->fds->del('fd_' . $fd);
}
}