Code Duplication    Length = 13-13 lines in 4 locations

src/RedisProxy.php 4 locations

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