Class yii\twig\ViewRendererStaticClassProxy

Inheritanceyii\twig\ViewRendererStaticClassProxy
Source Code https://github.com/yiisoft/yii2-twig/blob/master/src/ViewRendererStaticClassProxy.php

Class-proxy for static classes Needed because you can't pass static class to Twig other way

Method Details

Hide inherited methods

__call() public method

public mixed __call ( $method, $arguments )
$method string
$arguments array

                public function __call($method, $arguments)
{
    return call_user_func_array([$this->_staticClassName, $method], $arguments);
}

            
__construct() public method

public void __construct ( $staticClassName )
$staticClassName string

                public function __construct($staticClassName)
{
    $this->_staticClassName = $staticClassName;
}

            
__get() public method

public mixed __get ( $property )
$property string

                public function __get($property)
{
    $class = new \ReflectionClass($this->_staticClassName);
    
    $constants = $class->getConstants();
    if (array_key_exists($property, $constants)) {
        return $class->getConstant($property);
    }
    
    return $class->getStaticPropertyValue($property);
}

            
__isset() public method

public boolean __isset ( $property )
$property string

                public function __isset($property)
{
    $class = new \ReflectionClass($this->_staticClassName);
    $staticProps = $class->getStaticProperties();
    $constants = $class->getConstants();
    return array_key_exists($property, $staticProps) || array_key_exists($property, $constants);
}

            
__set() public method

public mixed __set ( $property, $value )
$property string
$value mixed

                public function __set($property, $value)
{
    $class = new \ReflectionClass($this->_staticClassName);
    $class->setStaticPropertyValue($property, $value);
    return $value;
}