You are here

public function Twig_NodeTraverser::addVisitor in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/twig/twig/lib/Twig/NodeTraverser.php \Twig_NodeTraverser::addVisitor()

Adds a visitor.

Parameters

Twig_NodeVisitorInterface $visitor A Twig_NodeVisitorInterface instance:

1 call to Twig_NodeTraverser::addVisitor()
Twig_NodeTraverser::__construct in vendor/twig/twig/lib/Twig/NodeTraverser.php
Constructor.

File

vendor/twig/twig/lib/Twig/NodeTraverser.php, line 43

Class

Twig_NodeTraverser
Twig_NodeTraverser is a node traverser.

Code

public function addVisitor(Twig_NodeVisitorInterface $visitor) {
  if (!isset($this->visitors[$visitor
    ->getPriority()])) {
    $this->visitors[$visitor
      ->getPriority()] = array();
  }
  $this->visitors[$visitor
    ->getPriority()][] = $visitor;
}