改名
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
|
* @param $name
|
||||||
* @return mixed
|
* @return mixed
|
||||||
@@ -137,10 +152,7 @@ class Component extends BaseObject
|
|||||||
*/
|
*/
|
||||||
public function __get($name)
|
public function __get($name)
|
||||||
{
|
{
|
||||||
$method = 'get' . ucfirst($name);
|
if (property_exists($this, $name)) {
|
||||||
if (method_exists($this, $method)) {
|
|
||||||
return $this->$method();
|
|
||||||
} else if (property_exists($this, $name)) {
|
|
||||||
return $this->$name ?? null;
|
return $this->$name ?? null;
|
||||||
} else {
|
} else {
|
||||||
return parent::__get($name);
|
return parent::__get($name);
|
||||||
|
|||||||
Reference in New Issue
Block a user