Class yii\twig\ViewRendererStaticClassProxy
Inheritance | yii\twig\ViewRendererStaticClassProxy |
---|---|
Source Code | https://github.com/yiisoft/yii2-twig/blob/master/ViewRendererStaticClassProxy.php |
Class-proxy for static classes Needed because you can't pass static class to Twig other way
Public Methods
Method Details
public mixed __call ( $method, $arguments ) | ||
$method | string | |
$arguments | array |
public function __call($method, $arguments)
{
return call_user_func_array([$this->_staticClassName, $method], $arguments);
}
public void __construct ( $staticClassName ) | ||
$staticClassName | string |
public function __construct($staticClassName)
{
$this->_staticClassName = $staticClassName;
}
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);
}
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);
}