改名
This commit is contained in:
@@ -130,6 +130,21 @@ class Component extends BaseObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $value
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
{
|
||||
if (property_exists($this, $name)) {
|
||||
$this->$name = $value;
|
||||
} else {
|
||||
parent::__set($name, $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @return mixed
|
||||
@@ -137,10 +152,7 @@ class Component extends BaseObject
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
$method = 'get' . ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
return $this->$method();
|
||||
} else if (property_exists($this, $name)) {
|
||||
if (property_exists($this, $name)) {
|
||||
return $this->$name ?? null;
|
||||
} else {
|
||||
return parent::__get($name);
|
||||
|
||||
Reference in New Issue
Block a user