This commit is contained in:
2023-08-18 17:33:06 +08:00
parent 57337cbe16
commit 092daa022a
+11 -6
View File
@@ -15,13 +15,18 @@ class Client
private CoroutineClient|CurlClient $abstracts; private CoroutineClient|CurlClient $abstracts;
/** /**
* @param string $host * @param string $host
* @param int $port * @param int $port
* @param bool $isSsl * @param bool $isSsl
*/ * @param bool $useCurl
public function __construct(string $host, int $port, bool $isSsl = false) */
public function __construct(string $host, int $port, bool $isSsl = false, bool $useCurl = false)
{ {
if ($useCurl) {
$this->abstracts = new CurlClient($host, $port, $isSsl);
return;
}
if (class_exists(Coroutine::class) && Coroutine::getCid() > -1) { if (class_exists(Coroutine::class) && Coroutine::getCid() > -1) {
$this->abstracts = new CoroutineClient($host, $port, $isSsl); $this->abstracts = new CoroutineClient($host, $port, $isSsl);
} else { } else {