Code Duplication    Length = 10-10 lines in 3 locations

Service/Repository.php 3 locations

@@ 243-252 (lines=10) @@
240
        return $this->findBy($criteria, $orderBy, 1, null)->current();
241
    }
242
243
    public function findDocuments(Search $search) :DocumentIterator
244
    {
245
        $results = $this->executeSearch($search);
246
247
        return new DocumentIterator(
248
            $results,
249
            $this->getManager(),
250
            $this->getScrollConfiguration($results, $search->getScroll())
251
        );
252
    }
253
254
    public function findArray(Search $search):ArrayIterator
255
    {
@@ 254-263 (lines=10) @@
251
        );
252
    }
253
254
    public function findArray(Search $search):ArrayIterator
255
    {
256
        $results = $this->executeSearch($search);
257
258
        return new ArrayIterator(
259
            $results,
260
            $this->getManager(),
261
            $this->getScrollConfiguration($results, $search->getScroll())
262
        );
263
    }
264
265
    public function findRaw(Search $search):RawIterator
266
    {
@@ 265-274 (lines=10) @@
262
        );
263
    }
264
265
    public function findRaw(Search $search):RawIterator
266
    {
267
        $results = $this->executeSearch($search);
268
269
        return new RawIterator(
270
            $results,
271
            $this->getManager(),
272
            $this->getScrollConfiguration($results, $search->getScroll())
273
        );
274
    }
275
276
    private function executeSearch(Search $search):array
277
    {