改名
This commit is contained in:
@@ -28,23 +28,23 @@ class Application extends HttpService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $methods
|
||||
* @param $name
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __get($methods)
|
||||
public function __get($name): mixed
|
||||
{
|
||||
if (method_exists($this, $methods)) {
|
||||
return $this->{$methods}();
|
||||
if (method_exists($this, $name)) {
|
||||
return $this->{$name}();
|
||||
}
|
||||
$handler = 'get' . ucfirst($methods);
|
||||
$handler = 'get' . ucfirst($name);
|
||||
if (method_exists($this, $handler)) {
|
||||
return $this->{$handler}();
|
||||
}
|
||||
if (property_exists($this, $methods)) {
|
||||
return $this->$methods;
|
||||
if (property_exists($this, $name)) {
|
||||
return $this->$name;
|
||||
}
|
||||
$message = sprintf('method %s::%s not exists.', get_called_class(), $methods);
|
||||
$message = sprintf('method %s::%s not exists.', get_called_class(), $name);
|
||||
throw new Exception($message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user