1 | <?php |
||
7 | class XmlIterator implements Iterator |
||
8 | { |
||
9 | /** |
||
10 | * @var int |
||
11 | */ |
||
12 | protected $position = 0; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $xmlFileUri; |
||
18 | |||
19 | /** |
||
20 | * @var string The name of the tag that delimits/separates each iterated element/row |
||
21 | */ |
||
22 | protected $delimiterTagName; |
||
23 | |||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $options = array( |
||
28 | /** |
||
29 | * @var string Encoding of source file |
||
30 | */ |
||
31 | "encoding" => null, |
||
32 | |||
33 | /** |
||
34 | * @var null See __construct() for the default |
||
35 | */ |
||
36 | "readerOptions" => null, |
||
37 | |||
38 | /** |
||
39 | * @var bool Activate UTF8 filter agains invalid (e.g. "out of allowed range") characters? |
||
40 | * |
||
41 | * Disable for performance gain if you know that the xml is clean of bad characters. |
||
42 | */ |
||
43 | "utf8Filter" => true, |
||
44 | |||
45 | /** |
||
46 | * @var bool Return current element as an array for ease of use? |
||
47 | * |
||
48 | * Disable for performance gain. Bu you need to do (string)$current->something for each sub-element. |
||
49 | */ |
||
50 | "asArray" => true, |
||
51 | ); |
||
52 | |||
53 | /** |
||
54 | * @var \XMLReader |
||
55 | */ |
||
56 | protected $reader; |
||
57 | |||
58 | /** |
||
59 | * @var \DOMDocument |
||
60 | */ |
||
61 | protected $doc; |
||
62 | |||
63 | /** |
||
64 | * @param string $xmlFileUri |
||
65 | * @param string $delimiterTagName |
||
66 | * @param array $options |
||
67 | * |
||
68 | * @throws \Exception |
||
69 | */ |
||
70 | 2 | public function __construct( |
|
90 | |||
91 | /** |
||
92 | * Return the current element, <b>FALSE</b> on error |
||
93 | * @link http://php.net/manual/en/iterator.current.php |
||
94 | * @link http://stackoverflow.com/a/1835324/372654 |
||
95 | * @return false|array|\SimpleXMLElement |
||
96 | */ |
||
97 | 2 | public function current() |
|
118 | |||
119 | /** |
||
120 | * Move forward to next element |
||
121 | * @link http://php.net/manual/en/iterator.next.php |
||
122 | * @return void Any returned value is ignored. |
||
123 | */ |
||
124 | 2 | public function next() |
|
130 | |||
131 | /** |
||
132 | * Return the key of the current element |
||
133 | * @link http://php.net/manual/en/iterator.key.php |
||
134 | * @return int scalar on success, or null on failure. |
||
135 | */ |
||
136 | public function key() |
||
140 | |||
141 | /** |
||
142 | * Checks if current position is valid |
||
143 | * @link http://php.net/manual/en/iterator.valid.php |
||
144 | * @return boolean The return value will be casted to boolean and then evaluated. |
||
145 | * Returns true on success or false on failure. |
||
146 | */ |
||
147 | 2 | public function valid() |
|
151 | |||
152 | /** |
||
153 | * Rewind the Iterator to the first element |
||
154 | * @link http://php.net/manual/en/iterator.rewind.php |
||
155 | * @throws \Exception |
||
156 | * @return void Any returned value is ignored. |
||
157 | */ |
||
158 | 2 | public function rewind() |
|
181 | } |
||
182 |
This check looks for
while
loops that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.Consider removing the loop.