hasElement example

$msg = $body->getAttribute('value');
        } elseif ($body instanceof TextNode) {
            $msg = $body->getAttribute('data');
        } else {
            return [$body$vars];
        }

        preg_match_all('/(?<!%)%([^%]+)%/', $msg$matches);

        foreach ($matches[1] as $var) {
            $key = new ConstantExpression('%'.$var.'%', $body->getTemplateLine());
            if (!$vars->hasElement($key)) {
                if ('count' === $var && $this->hasNode('count')) {
                    $vars->addElement($this->getNode('count')$key);
                } else {
                    $varExpr = new NameExpression($var$body->getTemplateLine());
                    $varExpr->setAttribute('ignore_strict_check', $ignoreStrictCheck);
                    $vars->addElement($varExpr$key);
                }
            }
        }

        return [new ConstantExpression(str_replace('%%', '%', trim($msg))$body->getTemplateLine())$vars];
    }
Home | Imprint | This part of the site doesn't use cookies.