1 | <?php |
||
5 | class NodeWalker |
||
6 | { |
||
7 | /** |
||
8 | * @var Node |
||
9 | */ |
||
10 | private $root; |
||
11 | |||
12 | /** |
||
13 | * @var Node |
||
14 | */ |
||
15 | private $current; |
||
16 | |||
17 | /** |
||
18 | * @var bool |
||
19 | */ |
||
20 | private $entering; |
||
21 | |||
22 | /** |
||
23 | * @param Node $root |
||
24 | */ |
||
25 | 1944 | public function __construct(Node $root) |
|
31 | |||
32 | /** |
||
33 | * Returns an event which contains node and entering flag |
||
34 | * (entering is true when we enter a Node from a parent or sibling, |
||
35 | * and false when we reenter it from child) |
||
36 | * |
||
37 | * @return NodeWalkerEvent|null |
||
38 | */ |
||
39 | 1944 | public function next() |
|
66 | |||
67 | /** |
||
68 | * Resets the iterator to resume at the specified node |
||
69 | * |
||
70 | * @param Node $node |
||
71 | * @param bool $entering |
||
72 | */ |
||
73 | 390 | public function resumeAt(Node $node, $entering = true) |
|
78 | } |
||
79 |