| 1 | <?php |
||
| 14 | class Iteration implements Iterator |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var XMLReader |
||
| 18 | */ |
||
| 19 | private $reader; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var bool |
||
| 23 | */ |
||
| 24 | private $valid; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var int |
||
| 28 | */ |
||
| 29 | private $index; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var bool |
||
| 33 | */ |
||
| 34 | private $skipNextRead; |
||
| 35 | |||
| 36 | 3 | public function __construct(XMLReader $reader) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * skip the next read on next next() |
||
| 43 | * |
||
| 44 | * this is useful of the reader has moved to the next node already inside a foreach iteration and the next |
||
| 45 | * next would move the reader one off. |
||
| 46 | * |
||
| 47 | * @see next |
||
| 48 | */ |
||
| 49 | 1 | public function skipNextRead() |
|
| 53 | |||
| 54 | /** |
||
| 55 | * @return XMLReader |
||
| 56 | */ |
||
| 57 | 2 | public function current() |
|
| 61 | |||
| 62 | 2 | public function next() |
|
| 73 | |||
| 74 | 2 | public function key() |
|
| 78 | |||
| 79 | 2 | public function valid() |
|
| 83 | |||
| 84 | 2 | public function rewind() |
|
| 93 | } |
||
| 94 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.