Code Duplication    Length = 24-24 lines in 2 locations

PHPDaemon/Clients/Mongo/Pool.php 2 locations

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