mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-11 19:20:01 +08:00
Fixed Object class.
This commit is contained in:
@@ -107,7 +107,6 @@ class Object
|
||||
{
|
||||
$getter = 'get' . $name;
|
||||
if (method_exists($this, $getter)) {
|
||||
// property is not null
|
||||
return $this->$getter() !== null;
|
||||
} else {
|
||||
return false;
|
||||
@@ -129,7 +128,6 @@ class Object
|
||||
{
|
||||
$setter = 'set' . $name;
|
||||
if (method_exists($this, $setter)) {
|
||||
// write property
|
||||
$this->$setter(null);
|
||||
} elseif (method_exists($this, 'get' . $name)) {
|
||||
throw new BadPropertyException('Unsetting read-only property: ' . get_class($this) . '.' . $name);
|
||||
@@ -150,9 +148,9 @@ class Object
|
||||
*/
|
||||
public function __call($name, $params)
|
||||
{
|
||||
if ($this->canGetProperty($name, false)) {
|
||||
$getter = 'get' . $name;
|
||||
$func = $this->$getter;
|
||||
$getter = 'get' . $name;
|
||||
if (method_exists($this, $getter)) {
|
||||
$func = $this->$getter();
|
||||
if ($func instanceof \Closure) {
|
||||
return call_user_func_array($func, $params);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user