| @@ 163-173 (lines=11) @@ | ||
| 160 | */ |
|
| 161 | public function next() |
|
| 162 | { |
|
| 163 | if (! $this->startedIterating) { |
|
| 164 | $this->ensureIterator(); |
|
| 165 | $this->startedIterating = true; |
|
| 166 | } else { |
|
| 167 | if ($this->cursorNeedsAdvancing) { |
|
| 168 | $this->ensureIterator()->next(); |
|
| 169 | } |
|
| 170 | ||
| 171 | $this->cursorNeedsAdvancing = true; |
|
| 172 | $this->position++; |
|
| 173 | } |
|
| 174 | ||
| 175 | return $this->storeIteratorState(); |
|
| 176 | } |
|
| @@ 220-228 (lines=9) @@ | ||
| 217 | */ |
|
| 218 | public function hasNext() |
|
| 219 | { |
|
| 220 | if (! $this->startedIterating) { |
|
| 221 | $this->ensureIterator(); |
|
| 222 | $this->startedIterating = true; |
|
| 223 | $this->storeIteratorState(); |
|
| 224 | $this->cursorNeedsAdvancing = false; |
|
| 225 | } elseif ($this->cursorNeedsAdvancing) { |
|
| 226 | $this->ensureIterator()->next(); |
|
| 227 | $this->cursorNeedsAdvancing = false; |
|
| 228 | } |
|
| 229 | ||
| 230 | return $this->ensureIterator()->valid(); |
|
| 231 | } |
|