Abstract Class yii\twig\Template

Inheritanceyii\twig\Template » Twig_Template
Source Code https://github.com/yiisoft/yii2-twig/blob/master/Template.php

Template base class

Protected Methods

Hide inherited methods

Method Description Defined By
getAttribute() yii\twig\Template

Method Details

Hide inherited methods

getAttribute() protected method

protected void getAttribute ( $object, $item, array $arguments = [], $type = \Twig_Template::ANY_CALL, $isDefinedTest false, $ignoreStrictCheck false )
$object
$item
$arguments
$type
$isDefinedTest
$ignoreStrictCheck

                protected function getAttribute($object, $item, array $arguments = [], $type = \Twig_Template::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false)
{
    // Twig uses isset() to check if attribute exists which does not work when attribute exists but is null
    if ($object instanceof \yii\base\Model) {
        if ($type === \Twig_Template::METHOD_CALL) {
            if ($this->env->hasExtension('sandbox')) {
                $this->env->getExtension('sandbox')->checkMethodAllowed($object, $item);
            }
            return call_user_func_array([$object, $item], $arguments);
        } else {
            if ($this->env->hasExtension('sandbox')) {
                $this->env->getExtension('sandbox')->checkPropertyAllowed($object, $item);
            }
            return $object->$item;
        }
    }
    return parent::getAttribute($object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);
}