Code Duplication    Length = 13-13 lines in 3 locations

src/RedisProxy.php 3 locations

@@ 506-518 (lines=13) @@
503
     * @param int $count
504
     * @return array|boolean|null list of found keys, returns null if $iterator is 0 or '0'
505
     */
506
    public function scan(&$iterator, $pattern = null, $count = null)
507
    {
508
        if ((string)$iterator === '0') {
509
            return null;
510
        }
511
        $this->init();
512
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
513
            $returned = $this->driver->scan($iterator, ['match' => $pattern, 'count' => $count]);
514
            $iterator = $returned[0];
515
            return $returned[1];
516
        }
517
        return $this->driver->scan($iterator, $pattern, $count);
518
    }
519
520
    /**
521
     * Get the value of a hash field
@@ 616-628 (lines=13) @@
613
     * @param int $count
614
     * @return array|boolean|null list of found fields with associated values, returns null if $iterator is 0 or '0'
615
     */
616
    public function hscan($key, &$iterator, $pattern = null, $count = null)
617
    {
618
        if ((string)$iterator === '0') {
619
            return null;
620
        }
621
        $this->init();
622
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
623
            $returned = $this->driver->hscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
624
            $iterator = $returned[0];
625
            return $returned[1];
626
        }
627
        return $this->driver->hscan($key, $iterator, $pattern, $count);
628
    }
629
630
    /**
631
     * Add one or more members to a set
@@ 676-688 (lines=13) @@
673
     * @param int $count
674
     * @return array|boolean|null list of found members, returns null if $iterator is 0 or '0'
675
     */
676
    public function sscan($key, &$iterator, $pattern = null, $count = null)
677
    {
678
        if ((string)$iterator === '0') {
679
            return null;
680
        }
681
        $this->init();
682
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
683
            $returned = $this->driver->sscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
684
            $iterator = $returned[0];
685
            return $returned[1];
686
        }
687
        return $this->driver->sscan($key, $iterator, $pattern, $count);
688
    }
689
690
    /**
691
     * Prepend one or multiple values to a list