yii\base\Object::__get PHP Method

__get() public method

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing $value = $object->property;.
See also: __set()
public __get ( string $name ) : mixed
$name string the property name
return mixed the property value
    public function __get($name)
    {
        $getter = 'get' . $name;
        if (method_exists($this, $getter)) {
            return $this->{$getter}();
        } elseif (method_exists($this, 'set' . $name)) {
            throw new InvalidCallException('Getting write-only property: ' . get_class($this) . '::' . $name);
        } else {
            throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name);
        }
    }

Usage Example

Example #1
0
 public function __get($property)
 {
     if ($this->isNestedProperty($property)) {
         return $this->getNestedProperty($property);
     }
     return parent::__get($property);
 }
All Usage Examples Of yii\base\Object::__get