Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d1adc532e1 | |||
| ec22ac39a3 |
+29
-6
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Kiri;
|
namespace Kiri;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Swoole\Coroutine;
|
use Swoole\Coroutine;
|
||||||
|
|
||||||
|
|
||||||
@@ -15,11 +16,11 @@ 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
|
||||||
*/
|
*/
|
||||||
public function __construct(string $host, int $port, bool $isSsl = false)
|
public function __construct(string $host, int $port, bool $isSsl = false)
|
||||||
{
|
{
|
||||||
if (class_exists(Coroutine::class) && Coroutine::getCid() > -1) {
|
if (class_exists(Coroutine::class) && Coroutine::getCid() > -1) {
|
||||||
@@ -32,7 +33,7 @@ class Client
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param array $arguments
|
* @param array $arguments
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function __call(string $name, array $arguments)
|
public function __call(string $name, array $arguments)
|
||||||
@@ -40,4 +41,26 @@ class Client
|
|||||||
return $this->abstracts->{$name}(...$arguments);
|
return $this->abstracts->{$name}(...$arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $name
|
||||||
|
* @return mixed
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function __get(string $name)
|
||||||
|
{
|
||||||
|
// TODO: Implement __get() method.
|
||||||
|
$getter = 'get' . ucfirst($name);
|
||||||
|
if (method_exists($this, $getter)) {
|
||||||
|
return $this->$getter();
|
||||||
|
} else if (method_exists($this, $name)) {
|
||||||
|
return $this->$name();
|
||||||
|
} else if (property_exists($this, $name)) {
|
||||||
|
return $this->$name;
|
||||||
|
} else {
|
||||||
|
throw new Exception('Property|Method "' . $name . '" does not exist.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user