Code Duplication    Length = 13-13 lines in 3 locations

src/RedisProxy.php 3 locations

@@ 456-468 (lines=13) @@
453
     * @param int $count
454
     * @return array|boolean|null list of found keys, returns null if $iterator is 0 or '0'
455
     */
456
    public function scan(&$iterator, $pattern = null, $count = null)
457
    {
458
        if ((string)$iterator === '0') {
459
            return null;
460
        }
461
        $this->init();
462
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
463
            $returned = $this->driver->scan($iterator, ['match' => $pattern, 'count' => $count]);
464
            $iterator = $returned[0];
465
            return $returned[1];
466
        }
467
        return $this->driver->scan($iterator, $pattern, $count);
468
    }
469
470
    /**
471
     * Get the value of a hash field
@@ 566-578 (lines=13) @@
563
     * @param int $count
564
     * @return array|boolean|null list of found fields with associated values, returns null if $iterator is 0 or '0'
565
     */
566
    public function hscan($key, &$iterator, $pattern = null, $count = null)
567
    {
568
        if ((string)$iterator === '0') {
569
            return null;
570
        }
571
        $this->init();
572
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
573
            $returned = $this->driver->hscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
574
            $iterator = $returned[0];
575
            return $returned[1];
576
        }
577
        return $this->driver->hscan($key, $iterator, $pattern, $count);
578
    }
579
580
    /**
581
     * Add one or more members to a set
@@ 626-638 (lines=13) @@
623
     * @param int $count
624
     * @return array|boolean|null list of found members, returns null if $iterator is 0 or '0'
625
     */
626
    public function sscan($key, &$iterator, $pattern = null, $count = null)
627
    {
628
        if ((string)$iterator === '0') {
629
            return null;
630
        }
631
        $this->init();
632
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
633
            $returned = $this->driver->sscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
634
            $iterator = $returned[0];
635
            return $returned[1];
636
        }
637
        return $this->driver->sscan($key, $iterator, $pattern, $count);
638
    }
639
640
    /**
641
     * Prepend one or multiple values to a list