Class Twig_NodeTraverser

InheritanceTwig_NodeTraverser

Twig_NodeTraverser is a node traverser.

It visits all nodes and their children and calls the given visitor for each.

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$env Twig_NodeTraverser
$visitors Twig_NodeTraverser

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor. Twig_NodeTraverser
addVisitor() Adds a visitor. Twig_NodeTraverser
traverse() Traverses a node and calls the registered visitors. Twig_NodeTraverser

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
traverseForVisitor() Twig_NodeTraverser

Property Details

$env protected property
protected $env null
$visitors protected property
protected $visitors = []

Method Details

__construct() public method

Constructor.

public void __construct ( Twig_Environment $env, array $visitors = [] )
$env Twig_Environment

A Twig_Environment instance

$visitors Twig_NodeVisitorInterface[]

An array of Twig_NodeVisitorInterface instances

addVisitor() public method

Adds a visitor.

public void addVisitor ( Twig_NodeVisitorInterface $visitor )
$visitor Twig_NodeVisitorInterface

A Twig_NodeVisitorInterface instance

traverse() public method

Traverses a node and calls the registered visitors.

public Twig_NodeInterface traverse ( Twig_NodeInterface $node )
$node Twig_NodeInterface

A Twig_NodeInterface instance

traverseForVisitor() protected method

protected void traverseForVisitor ( Twig_NodeVisitorInterface $visitor, Twig_NodeInterface $node null )
$visitor
$node