Code Duplication    Length = 8-8 lines in 2 locations

src/MongoDB.php 2 locations

@@ 197-204 (lines=8) @@
194
            $cursor = $collection->find($query_filters, $options);
195
            $iterator = new \IteratorIterator($cursor);
196
            $iterator->rewind();
197
            while ($doc = $iterator->current()) {
198
                if (isset($doc['_id'])) {
199
                    $doc['id'] = (string) $doc['_id'];
200
                    unset($doc['_id']);
201
                }
202
                $results[] = $doc;
203
                $iterator->next();
204
            }
205
            return ['total' => $count, 'data' => $results];
206
        }
207
        return ['total' => 0, 'data' => null];
@@ 99-106 (lines=8) @@
96
        $iterator = new \IteratorIterator($cursor);
97
        $iterator->rewind();
98
        $results=[];
99
        while ($doc = $iterator->current()) {
100
            if (isset($doc['_id'])) {
101
                $doc['id'] = (string) $doc['_id'];
102
                unset($doc['_id']);
103
            }
104
            $results[$doc['id']] = $doc;
105
            $iterator->next();
106
        }
107
        return $results;
108
    }
109