| 1 | <?php |
||
| 10 | class NodeTraverser |
||
| 11 | { |
||
| 12 | const DONT_TRAVERSE_CHILDREN = 'DONT_TRAVERSE_CHILDREN'; |
||
| 13 | const REMOVE_NODE = 'REMOVE_NODE'; |
||
| 14 | |||
| 15 | private $visitor; |
||
| 16 | |||
| 17 | public function __construct() |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Registers a new visitor with this traverser. |
||
| 24 | * |
||
| 25 | * @param VisitorInterface $visitor |
||
| 26 | */ |
||
| 27 | public function addVisitor(VisitorInterface $visitor) |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Starts traversing the tree, calling each visitor on each node. |
||
| 34 | * |
||
| 35 | * @param NodeInterface $node |
||
| 36 | */ |
||
| 37 | public function walk(NodeInterface $node) |
||
| 41 | } |
||
| 42 |