Code Duplication    Length = 8-10 lines in 2 locations

lib/Alcaeus/MongoDbAdapter/AbstractCursor.php 1 location

@@ 292-301 (lines=10) @@
289
    /**
290
     * @return \Iterator
291
     */
292
    protected function ensureIterator()
293
    {
294
        if ($this->iterator === null) {
295
            // MongoDB\Driver\Cursor needs to be wrapped into a \Generator so that a valid \Iterator with working implementations of
296
            // next, current, valid, key and rewind is returned. These methods don't work if we wrap the Cursor inside an \IteratorIterator
297
            $this->iterator = $this->wrapTraversable($this->ensureCursor());
298
        }
299
300
        return $this->iterator;
301
    }
302
303
    /**
304
     * @param \Traversable $traversable

lib/Mongo/MongoCursor.php 1 location

@@ 176-183 (lines=8) @@
173
            'options' => $this->options,
174
            'operation' => 'count',
175
            'name' => $this->collection->getCollectionName()
176
        ], function () {
177
            // MongoDB\Driver\Cursor needs to be wrapped into a \Generator so that a valid \Iterator with working implementations of
178
            // next, current, valid, key and rewind is returned. These methods don't work if we wrap the Cursor inside an \IteratorIterator
179
            if ($this->iterator === null) {
180
                $this->iterator = $this->wrapTraversable($this->ensureCursor());
181
            }
182
            return $this->iterator;
183
        });
184
    }
185
186
    /**