Code Duplication    Length = 13-13 lines in 3 locations

src/RedisProxy.php 3 locations

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