40 if (!isset($this->visitors[$visitor->
getPriority()])) {
44 $this->visitors[$visitor->
getPriority()][] = $visitor;
54 ksort($this->visitors);
56 foreach ($visitors as $visitor) {
70 $node = $visitor->
enterNode($node, $this->env);
72 foreach ($node as $k =>
$n) {
74 $node->setNode($k,
$n);
76 $node->removeNode($k);
80 return $visitor->
leaveNode($node, $this->env);
84 class_alias(
'Twig_NodeTraverser',
'Twig\NodeTraverser',
false);
Represents a node in the AST.
Twig_NodeTraverser is a node traverser.
enterNode(Twig_NodeInterface $node, Twig_Environment $env)
Called before child nodes are visited.
traverseForVisitor(Twig_NodeVisitorInterface $visitor, Twig_NodeInterface $node=null)
getPriority()
Returns the priority for this visitor.
Twig_NodeVisitorInterface is the interface the all node visitor classes must implement.
addVisitor(Twig_NodeVisitorInterface $visitor)
traverse(Twig_NodeInterface $node)
Traverses a node and calls the registered visitors.
Stores the Twig configuration.
leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
Called after child nodes are visited.
__construct(Twig_Environment $env, array $visitors=array())