@@ 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 | } |
@@ 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 | } |