Total Complexity | 8 |
Total Lines | 84 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class RecursiveDOMIterator implements RecursiveIterator |
||
9 | { |
||
10 | /** |
||
11 | * Current Position in DOMNodeList. |
||
12 | * @var int |
||
13 | */ |
||
14 | protected $_position; |
||
15 | |||
16 | /** |
||
17 | * The DOMNodeList with all children to iterate over. |
||
|
|||
18 | * @var DOMNodeList |
||
19 | */ |
||
20 | protected $_nodeList; |
||
21 | |||
22 | /** |
||
23 | * @param DOMNode $domNode |
||
24 | */ |
||
25 | public function __construct(DOMNode $domNode) |
||
26 | { |
||
27 | $this->_position = 0; |
||
28 | $this->_nodeList = $domNode->childNodes; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Returns the current DOMNode. |
||
33 | * @return DOMNode |
||
34 | */ |
||
35 | public function current() |
||
36 | { |
||
37 | return $this->_nodeList->item($this->_position); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Returns an iterator for the current iterator entry. |
||
42 | * @return RecursiveDOMIterator |
||
43 | */ |
||
44 | public function getChildren() |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * Returns if an iterator can be created for the current entry. |
||
51 | * @return bool |
||
52 | */ |
||
53 | public function hasChildren() |
||
54 | { |
||
55 | return $this->current()->hasChildNodes(); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Returns the current position. |
||
60 | * @return int |
||
61 | */ |
||
62 | public function key() |
||
63 | { |
||
64 | return $this->_position; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Moves the current position to the next element. |
||
69 | * @return void |
||
70 | */ |
||
71 | public function next() |
||
72 | { |
||
73 | $this->_position++; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * Rewind the Iterator to the first element. |
||
78 | * @return void |
||
79 | */ |
||
80 | public function rewind() |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * Checks if current position is valid. |
||
87 | * @return bool |
||
88 | */ |
||
89 | public function valid() |
||
92 | } |
||
93 | } |
||
94 |