Methods |
public
|
beforeTraverse(Node[] $nodes): null|Node[]
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): null|int|Node
Called when entering a node.
Called when entering a node.
Return value semantics:
- null
=> $node stays as-is
- NodeTraverser::DONT_TRAVERSE_CHILDREN
=> Children of $node 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): null|int|Node|Node[]
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): null|Node[]
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
|
#
|