1 | <?php |
||
47 | class DOMIterator extends \ArrayIterator implements \RecursiveIterator |
||
48 | { |
||
49 | /** |
||
50 | * Element processor |
||
51 | * |
||
52 | * @var ElementProcessorInterface |
||
53 | */ |
||
54 | protected $elementProcessor; |
||
55 | /** |
||
56 | * Initial parser context |
||
57 | * |
||
58 | * @var Context |
||
59 | */ |
||
60 | protected $initialContext; |
||
61 | /** |
||
62 | * Registered contexts |
||
63 | * |
||
64 | * @var Context[] |
||
65 | */ |
||
66 | public $contexts = []; |
||
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 | 3 | public function __construct( |
|
116 | |||
117 | /** |
||
118 | * Return the recursive iterator |
||
119 | * |
||
120 | * @return \RecursiveIteratorIterator Recursive iterator |
||
121 | */ |
||
122 | 3 | public function getRecursiveIterator() |
|
126 | |||
127 | /** |
||
128 | * Return whether the current node has child nodes |
||
129 | * |
||
130 | * This method gets called once per element and prior to the call to current(), |
||
131 | * so this seems like the perfect place for the first processing steps (even |
||
132 | * for elements without children). |
||
133 | * |
||
134 | * @return boolean Current node has child nodes |
||
135 | */ |
||
136 | 3 | public function hasChildren() |
|
140 | |||
141 | /** |
||
142 | * Return a child node iterator |
||
143 | * |
||
144 | * @return DOMIterator Child node iterator |
||
145 | */ |
||
146 | 3 | public function getChildren() |
|
155 | |||
156 | /** |
||
157 | * Rewind array back to the start |
||
158 | * |
||
159 | * @return void |
||
160 | */ |
||
161 | 3 | public function rewind() |
|
165 | } |
||
166 |