Methods |
public
|
beforeTraverse(Node[] $nodes): Node[]|null
Called once before traversal.
Called once before traversal.
Return value semantics:
- null: $nodes stays as-is
- otherwise: $nodes is set to the return value
Parameters
Returns
Implemented by
|
#
|
public
|
enterNode(Node $node): Node|Node[]|NodeTraverser::*|null
Called when entering a node.
Called when entering a node.
Return value semantics:
- null
=> $node stays as-is
- array (of Nodes)
=> The return value is merged into the parent array (at the position of the $node)
- NodeTraverser::REMOVE_NODE
=> $node is removed from the parent array
- NodeTraverser::DONT_TRAVERSE_CHILDREN
=> Children of $node are not traversed. $node stays as-is
- NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN
=> Further visitors for the current node are skipped, and its children are not
traversed. $node stays as-is.
- NodeTraverser::STOP_TRAVERSAL
=> Traversal is aborted. $node stays as-is
- otherwise
=> $node is set to the return value
Parameters
Returns
Replacement node (or special return value)
Implemented by
|
#
|
public
|
leaveNode(Node $node): Node|Node[]|NodeTraverser::REMOVE_NODE|NodeTraverser::STOP_TRAVERSAL|null
Called when leaving a node.
Called when leaving a node.
Return value semantics:
- null
=> $node stays as-is
- NodeTraverser::REMOVE_NODE
=> $node is removed from the parent array
- NodeTraverser::STOP_TRAVERSAL
=> Traversal is aborted. $node stays as-is
- array (of Nodes)
=> The return value is merged into the parent array (at the position of the $node)
- otherwise
=> $node is set to the return value
Parameters
Returns
Replacement node (or special return value)
Implemented by
|
#
|
public
|
afterTraverse(Node[] $nodes): Node[]|null
Called once after traversal.
Called once after traversal.
Return value semantics:
- null: $nodes stays as-is
- otherwise: $nodes is set to the return value
Parameters
Returns
Implemented by
|
#
|