Total Complexity | 7 |
Total Lines | 78 |
Duplicated Lines | 0 % |
Coverage | 84.21% |
Changes | 0 |
1 | <?php |
||
11 | class IterableResult implements \Iterator |
||
12 | { |
||
13 | /** |
||
14 | * @var AbstractHydrator |
||
15 | */ |
||
16 | private $hydrator; |
||
17 | |||
18 | /** |
||
19 | * @var bool |
||
20 | */ |
||
21 | private $rewinded = false; |
||
22 | |||
23 | /** |
||
24 | * @var int |
||
25 | */ |
||
26 | private $key = -1; |
||
27 | |||
28 | /** |
||
29 | * @var object|null |
||
30 | */ |
||
31 | private $current; |
||
32 | |||
33 | /** |
||
34 | * @param AbstractHydrator $hydrator |
||
35 | */ |
||
36 | 11 | public function __construct($hydrator) |
|
37 | { |
||
38 | 11 | $this->hydrator = $hydrator; |
|
39 | 11 | } |
|
40 | |||
41 | /** |
||
42 | * @throws HydrationException |
||
43 | */ |
||
44 | 5 | public function rewind() |
|
45 | { |
||
46 | 5 | if ($this->rewinded === true) { |
|
47 | throw new HydrationException('Can only iterate a Result once.'); |
||
48 | } |
||
49 | |||
50 | 5 | $this->current = $this->next(); |
|
|
|||
51 | 5 | $this->rewinded = true; |
|
52 | 5 | } |
|
53 | |||
54 | /** |
||
55 | * Gets the next set of results. |
||
56 | * |
||
57 | * @return mixed[]|false |
||
58 | */ |
||
59 | 10 | public function next() |
|
65 | } |
||
66 | |||
67 | /** |
||
68 | * @return mixed |
||
69 | */ |
||
70 | 5 | public function current() |
|
71 | { |
||
72 | 5 | return $this->current; |
|
73 | } |
||
74 | |||
75 | /** |
||
76 | * @return int |
||
77 | */ |
||
78 | public function key() |
||
79 | { |
||
80 | return $this->key; |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @return bool |
||
85 | */ |
||
86 | 5 | public function valid() |
|
89 | } |
||
90 | } |
||
91 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..