Code Duplication    Length = 13-13 lines in 3 locations

src/RedisProxy.php 3 locations

@@ 422-434 (lines=13) @@
419
     * @param int $count
420
     * @return array|boolean|null list of found keys, returns null if $iterator is 0 or '0'
421
     */
422
    public function scan(&$iterator, $pattern = null, $count = null)
423
    {
424
        if ((string)$iterator === '0') {
425
            return null;
426
        }
427
        $this->init();
428
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
429
            $returned = $this->driver->scan($iterator, ['match' => $pattern, 'count' => $count]);
430
            $iterator = $returned[0];
431
            return $returned[1];
432
        }
433
        return $this->driver->scan($iterator, $pattern, $count);
434
    }
435
436
    /**
437
     * Get the value of a hash field
@@ 532-544 (lines=13) @@
529
     * @param int $count
530
     * @return array|boolean|null list of found fields with associated values, returns null if $iterator is 0 or '0'
531
     */
532
    public function hscan($key, &$iterator, $pattern = null, $count = null)
533
    {
534
        if ((string)$iterator === '0') {
535
            return null;
536
        }
537
        $this->init();
538
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
539
            $returned = $this->driver->hscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
540
            $iterator = $returned[0];
541
            return $returned[1];
542
        }
543
        return $this->driver->hscan($key, $iterator, $pattern, $count);
544
    }
545
546
    /**
547
     * Add one or more members to a set
@@ 592-604 (lines=13) @@
589
     * @param int $count
590
     * @return array|boolean|null list of found members, returns null if $iterator is 0 or '0'
591
     */
592
    public function sscan($key, &$iterator, $pattern = null, $count = null)
593
    {
594
        if ((string)$iterator === '0') {
595
            return null;
596
        }
597
        $this->init();
598
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
599
            $returned = $this->driver->sscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
600
            $iterator = $returned[0];
601
            return $returned[1];
602
        }
603
        return $this->driver->sscan($key, $iterator, $pattern, $count);
604
    }
605
606
    /**
607
     * Prepend one or multiple values to a list