Code Duplication    Length = 24-24 lines in 2 locations

PHPDaemon/Clients/Mongo/Pool.php 2 locations

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