| Total Complexity | 7 |
| Total Lines | 68 |
| Duplicated Lines | 0 % |
| Coverage | 80% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class AnyIterator extends GenericIterator |
||
| 9 | { |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Row Elements |
||
| 13 | * @var array |
||
| 14 | */ |
||
| 15 | private $list; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Current row number |
||
| 19 | * @var int |
||
| 20 | */ |
||
| 21 | private $curRow; //int |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Iterator constructor |
||
| 25 | * |
||
| 26 | * @param Row[] $list |
||
| 27 | */ |
||
| 28 | 18 | public function __construct($list) |
|
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @inheritDoc |
||
| 36 | */ |
||
| 37 | 18 | public function count() |
|
| 38 | { |
||
| 39 | 18 | return count($this->list); |
|
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @inheritDoc |
||
| 44 | */ |
||
| 45 | 17 | public function hasNext() |
|
| 46 | { |
||
| 47 | 17 | return ($this->curRow < $this->count()); |
|
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @inheritDoc |
||
| 52 | */ |
||
| 53 | 17 | public function moveNext() |
|
| 54 | { |
||
| 55 | 17 | if (!$this->hasNext()) { |
|
| 56 | return null; |
||
| 57 | } |
||
| 58 | 17 | return $this->list[$this->curRow++]; |
|
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @inheritDoc |
||
| 63 | */ |
||
| 64 | public function key() |
||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @param IteratorFilter $filter |
||
| 71 | * @return AnyIterator |
||
| 72 | */ |
||
| 73 | 1 | public function withFilter(IteratorFilter $filter) |
|
| 76 | } |
||
| 77 | } |
||
| 78 |