Code Duplication    Length = 13-13 lines in 3 locations

src/RedisProxy.php 3 locations

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