Code Duplication    Length = 13-13 lines in 4 locations

src/RedisProxy.php 4 locations

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