protected function Twig_NodeTraverser::traverseForVisitor in Translation template extractor 7.3
Same name and namespace in other branches
- 6.3 vendor/Twig/NodeTraverser.php \Twig_NodeTraverser::traverseForVisitor()
1 call to Twig_NodeTraverser::traverseForVisitor()
- Twig_NodeTraverser::traverse in vendor/
Twig/ NodeTraverser.php - Traverses a node and calls the registered visitors.
File
- vendor/
Twig/ NodeTraverser.php, line 71
Class
- Twig_NodeTraverser
- Twig_NodeTraverser is a node traverser.
Code
protected function traverseForVisitor(Twig_NodeVisitorInterface $visitor, Twig_NodeInterface $node = null) {
if (null === $node) {
return;
}
$node = $visitor
->enterNode($node, $this->env);
foreach ($node as $k => $n) {
if (false !== ($n = $this
->traverseForVisitor($visitor, $n))) {
$node
->setNode($k, $n);
}
else {
$node
->removeNode($k);
}
}
return $visitor
->leaveNode($node, $this->env);
}