Code Duplication    Length = 24-24 lines in 2 locations

PHPDaemon/Clients/Mongo/Pool.php 2 locations

@@ 269-292 (lines=24) @@
266
        $o = [];
267
        $s = false;
268
269
        foreach ($p as $k => $v) {
270
            if (($k === 'sort') || ($k === 'hint') || ($k === 'explain') || ($k === 'snapshot')) {
271
                if (!$s) {
272
                    $s = true;
273
                }
274
275
                if ($k === 'sort') {
276
                    $o['orderby'] = $v;
277
                } elseif ($k === 'parse_oplog') {
278
                } elseif ($k === 'rp') {
279
                    $o['$readPreference'] = $v;
280
                } else {
281
                    $o[$k] = $v;
282
                }
283
            }
284
        }
285
286
        if ($s) {
287
            $o['query'] = $p['where'];
288
        } else {
289
            $o = $p['where'];
290
        }
291
292
        if (empty($o['orderby'])) {
293
            unset($o['orderby']);
294
        }
295
@@ 364-387 (lines=24) @@
361
        $o = [];
362
        $s = false;
363
364
        foreach ($p as $k => $v) {
365
            if (($k === 'sort') || ($k === 'hint') || ($k === 'explain') || ($k === 'snapshot')) {
366
                if (!$s) {
367
                    $s = true;
368
                }
369
370
                if ($k === 'sort') {
371
                    $o['orderby'] = $v;
372
                } elseif ($k === 'parse_oplog') {
373
                } elseif ($k === 'rp') {
374
                    $o['$readPreference'] = $v;
375
                } else {
376
                    $o[$k] = $v;
377
                }
378
            }
379
        }
380
        if (empty($o['orderby'])) {
381
            unset($o['orderby']);
382
        }
383
384
        if ($s) {
385
            $o['query'] = $p['where'];
386
        } else {
387
            $o = $p['where'];
388
        }
389
        $cb = CallbackWrapper::wrap($cb);
390
        if ($this->safeMode) {