Code Duplication    Length = 13-13 lines in 4 locations

src/RedisProxy.php 4 locations

@@ 512-524 (lines=13) @@
509
     * @param int $count
510
     * @return array|boolean|null list of found keys, returns null if $iterator is 0 or '0'
511
     */
512
    public function scan(&$iterator, $pattern = null, $count = null)
513
    {
514
        if ((string)$iterator === '0') {
515
            return null;
516
        }
517
        $this->init();
518
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
519
            $returned = $this->driver->scan($iterator, ['match' => $pattern, 'count' => $count]);
520
            $iterator = $returned[0];
521
            return $returned[1];
522
        }
523
        return $this->driver->scan($iterator, $pattern, $count);
524
    }
525
526
    /**
527
     * Get the value of a hash field
@@ 622-634 (lines=13) @@
619
     * @param int $count
620
     * @return array|boolean|null list of found fields with associated values, returns null if $iterator is 0 or '0'
621
     */
622
    public function hscan($key, &$iterator, $pattern = null, $count = null)
623
    {
624
        if ((string)$iterator === '0') {
625
            return null;
626
        }
627
        $this->init();
628
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
629
            $returned = $this->driver->hscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
630
            $iterator = $returned[0];
631
            return $returned[1];
632
        }
633
        return $this->driver->hscan($key, $iterator, $pattern, $count);
634
    }
635
636
    /**
637
     * Add one or more members to a set
@@ 682-694 (lines=13) @@
679
     * @param int $count
680
     * @return array|boolean|null list of found members, returns null if $iterator is 0 or '0'
681
     */
682
    public function sscan($key, &$iterator, $pattern = null, $count = null)
683
    {
684
        if ((string)$iterator === '0') {
685
            return null;
686
        }
687
        $this->init();
688
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
689
            $returned = $this->driver->sscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
690
            $iterator = $returned[0];
691
            return $returned[1];
692
        }
693
        return $this->driver->sscan($key, $iterator, $pattern, $count);
694
    }
695
696
    /**
697
     * Prepend one or multiple values to a list
@@ 816-828 (lines=13) @@
813
     * @param int $count
814
     * @return array|boolean|null list of found members with their values, returns null if $iterator is 0 or '0'
815
     */
816
    public function zscan($key, &$iterator, $pattern = null, $count = null)
817
    {
818
        if ((string)$iterator === '0') {
819
            return null;
820
        }
821
        $this->init();
822
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
823
            $returned = $this->driver->zscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
824
            $iterator = $returned[0];
825
            return $returned[1];
826
        }
827
        return $this->driver->zscan($key, $iterator, $pattern, $count);
828
    }
829
830
    /**
831
     * Return a range of members in a sorted set, by index, with scores ordered from high to low