Code Duplication    Length = 9-11 lines in 2 locations

lib/Alcaeus/MongoDbAdapter/AbstractCursor.php 1 location

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

lib/Mongo/MongoCursor.php 1 location

@@ 245-253 (lines=9) @@
242
     */
243
    public function hasNext()
244
    {
245
        if (! $this->startedIterating) {
246
            $this->ensureIterator();
247
            $this->startedIterating = true;
248
            $this->storeIteratorState();
249
            $this->cursorNeedsAdvancing = false;
250
        } elseif ($this->cursorNeedsAdvancing) {
251
            $this->ensureIterator()->next();
252
            $this->cursorNeedsAdvancing = false;
253
        }
254
255
        return $this->ensureIterator()->valid();
256
    }