Compare commits
2 Commits
v2.12
...
d1adc532e1
| Author | SHA1 | Date | |
|---|---|---|---|
| d1adc532e1 | |||
| ec22ac39a3 |
+23
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Kiri;
|
||||
|
||||
use Exception;
|
||||
use Swoole\Coroutine;
|
||||
|
||||
|
||||
@@ -40,4 +41,26 @@ class Client
|
||||
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