| @@ 244-252 (lines=9) @@ | ||
| 241 | */ |
|
| 242 | public function hasNext() |
|
| 243 | { |
|
| 244 | if (! $this->startedIterating) { |
|
| 245 | $this->ensureIterator(); |
|
| 246 | $this->startedIterating = true; |
|
| 247 | $this->storeIteratorState(); |
|
| 248 | $this->cursorNeedsAdvancing = false; |
|
| 249 | } elseif ($this->cursorNeedsAdvancing) { |
|
| 250 | $this->ensureIterator()->next(); |
|
| 251 | $this->cursorNeedsAdvancing = false; |
|
| 252 | } |
|
| 253 | ||
| 254 | return $this->ensureIterator()->valid(); |
|
| 255 | } |
|
| @@ 168-178 (lines=11) @@ | ||
| 165 | */ |
|
| 166 | public function next() |
|
| 167 | { |
|
| 168 | if (! $this->startedIterating) { |
|
| 169 | $this->ensureIterator(); |
|
| 170 | $this->startedIterating = true; |
|
| 171 | } else { |
|
| 172 | if ($this->cursorNeedsAdvancing) { |
|
| 173 | $this->ensureIterator()->next(); |
|
| 174 | } |
|
| 175 | ||
| 176 | $this->cursorNeedsAdvancing = true; |
|
| 177 | $this->position++; |
|
| 178 | } |
|
| 179 | ||
| 180 | return $this->storeIteratorState(); |
|
| 181 | } |
|