Total Complexity | 6 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
8 | abstract class GenericIterator implements IteratorInterface, Iterator, DumpToArrayInterface |
||
9 | { |
||
10 | |||
11 | abstract public function hasNext(); |
||
12 | |||
13 | abstract public function moveNext(); |
||
14 | |||
15 | abstract public function count(); |
||
16 | |||
17 | abstract public function key(); |
||
18 | |||
19 | /** |
||
20 | * @return array |
||
21 | * @throws \ByJG\Serializer\Exception\InvalidArgumentException |
||
22 | */ |
||
23 | 13 | public function toArray() |
|
24 | { |
||
25 | 13 | $retArray = []; |
|
26 | |||
27 | 13 | while ($this->hasNext()) { |
|
28 | 13 | $singleRow = $this->moveNext(); |
|
29 | 13 | $retArray[] = $singleRow->toArray(); |
|
30 | } |
||
31 | |||
32 | 13 | return $retArray; |
|
33 | } |
||
34 | /* ------------------------------------- */ |
||
35 | /* PHP 5 Specific functions for Iterator */ |
||
36 | /* ------------------------------------- */ |
||
37 | |||
38 | /** |
||
39 | * @return Row |
||
40 | */ |
||
41 | 2 | public function current() |
|
44 | } |
||
45 | |||
46 | public function rewind() |
||
47 | { |
||
48 | // There is no necessary |
||
49 | } |
||
50 | |||
51 | public function next() |
||
52 | { |
||
53 | // There is no necessary |
||
54 | } |
||
55 | |||
56 | 2 | public function valid() |
|
59 | } |
||
60 | } |
||
61 |