Methods |
public
|
__construct(NodeVisitor ...$visitors)
Create a traverser with the given visitors.
Create a traverser with the given visitors.
Parameters
...$visitors |
Node visitors
|
|
#
|
public
|
addVisitor(NodeVisitor $visitor): void
Adds a visitor.
|
#
|
public
|
removeVisitor(NodeVisitor $visitor): void
Removes an added visitor.
Removes an added visitor.
Implements
|
#
|
public
|
traverse(Node[] $nodes): Node[]
Traverses an array of nodes using the registered visitors.
Traverses an array of nodes using the registered visitors.
Parameters
Returns
Implements
|
#
|
protected
|
traverseNode(Node $node): void
Recursively traverse a node.
Recursively traverse a node.
Parameters
|
#
|
protected
|
traverseArray(array $nodes): array
Recursively traverse array (usually of nodes).
Recursively traverse array (usually of nodes).
Parameters
Returns
Result of traversal (may be original array or changed one)
|
#
|