1 | <?php |
||
47 | class DOMIterator extends \ArrayIterator implements \RecursiveIterator |
||
48 | { |
||
49 | /** |
||
50 | * Registered contexts |
||
51 | * |
||
52 | * @var Context[] |
||
53 | */ |
||
54 | public $contexts = []; |
||
55 | /** |
||
56 | * Element processor |
||
57 | * |
||
58 | * @var ElementProcessorInterface |
||
59 | */ |
||
60 | protected $elementProcessor; |
||
61 | /** |
||
62 | * Initial parser context |
||
63 | * |
||
64 | * @var Context |
||
65 | */ |
||
66 | protected $initialContext; |
||
67 | /** |
||
68 | * Element context map |
||
69 | * |
||
70 | * @var array |
||
71 | */ |
||
72 | protected $contextMap = []; |
||
73 | |||
74 | /** |
||
75 | * Recursive DOM node iterator constructor |
||
76 | * |
||
77 | * @param \DOMNodeList $nodeList Node list |
||
78 | * @param Context $initialContext Initial parser context |
||
79 | * @param ElementProcessorInterface $elementProcessor Element processor |
||
80 | */ |
||
81 | 9 | public function __construct( |
|
99 | |||
100 | /** |
||
101 | * Register an element node |
||
102 | * |
||
103 | * @param \DOMNode $node Node |
||
104 | * @return \DOMNode Node |
||
105 | */ |
||
106 | 9 | protected function registerNode(\DOMNode $node) |
|
123 | |||
124 | /** |
||
125 | * Return the recursive iterator |
||
126 | * |
||
127 | * @return \RecursiveIteratorIterator Recursive iterator |
||
128 | */ |
||
129 | 9 | public function getRecursiveIterator() |
|
133 | |||
134 | /** |
||
135 | * Return whether the current node has child nodes |
||
136 | * |
||
137 | * This method gets called once per element and prior to the call to current(), |
||
138 | * so this seems like the perfect place for the first processing steps (even |
||
139 | * for elements without children). |
||
140 | * |
||
141 | * @return boolean Current node has child nodes |
||
142 | */ |
||
143 | 9 | public function hasChildren() |
|
147 | |||
148 | /** |
||
149 | * Return a child node iterator |
||
150 | * |
||
151 | * @return DOMIterator Child node iterator |
||
152 | */ |
||
153 | 9 | public function getChildren() |
|
162 | |||
163 | /** |
||
164 | * Rewind array back to the start |
||
165 | * |
||
166 | * @return void |
||
167 | */ |
||
168 | 9 | public function rewind() |
|
172 | } |
||
173 |