33 $this->visitors = array();
46 if (!isset($this->visitors[$visitor->
getPriority()])) {
50 $this->visitors[$visitor->
getPriority()][] = $visitor;
60 ksort($this->visitors);
62 foreach ($visitors as $visitor) {
76 $node = $visitor->
enterNode($node, $this->env);
78 foreach ($node as $k => $n) {
80 $node->setNode($k, $n);
82 $node->removeNode($k);
86 return $visitor->
leaveNode($node, $this->env);
getPriority()
Returns the priority for this visitor.
Twig_NodeTraverser is a node traverser.
traverse(Twig_NodeInterface $node)
Traverses a node and calls the registered visitors.
addVisitor(Twig_NodeVisitorInterface $visitor)
Adds a visitor.
leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
Called after child nodes are visited.
Twig_NodeVisitorInterface is the interface the all node visitor classes must implement.
Represents a node in the AST.
Stores the Twig configuration.
enterNode(Twig_NodeInterface $node, Twig_Environment $env)
Called before child nodes are visited.
__construct(Twig_Environment $env, array $visitors=array())
Constructor.
traverseForVisitor(Twig_NodeVisitorInterface $visitor, Twig_NodeInterface $node=null)