Code Duplication    Length = 13-13 lines in 3 locations

src/RedisProxy.php 3 locations

@@ 464-476 (lines=13) @@
461
     * @param int $count
462
     * @return array|boolean|null list of found keys, returns null if $iterator is 0 or '0'
463
     */
464
    public function scan(&$iterator, $pattern = null, $count = null)
465
    {
466
        if ((string)$iterator === '0') {
467
            return null;
468
        }
469
        $this->init();
470
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
471
            $returned = $this->driver->scan($iterator, ['match' => $pattern, 'count' => $count]);
472
            $iterator = $returned[0];
473
            return $returned[1];
474
        }
475
        return $this->driver->scan($iterator, $pattern, $count);
476
    }
477
478
    /**
479
     * Get the value of a hash field
@@ 574-586 (lines=13) @@
571
     * @param int $count
572
     * @return array|boolean|null list of found fields with associated values, returns null if $iterator is 0 or '0'
573
     */
574
    public function hscan($key, &$iterator, $pattern = null, $count = null)
575
    {
576
        if ((string)$iterator === '0') {
577
            return null;
578
        }
579
        $this->init();
580
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
581
            $returned = $this->driver->hscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
582
            $iterator = $returned[0];
583
            return $returned[1];
584
        }
585
        return $this->driver->hscan($key, $iterator, $pattern, $count);
586
    }
587
588
    /**
589
     * Add one or more members to a set
@@ 634-646 (lines=13) @@
631
     * @param int $count
632
     * @return array|boolean|null list of found members, returns null if $iterator is 0 or '0'
633
     */
634
    public function sscan($key, &$iterator, $pattern = null, $count = null)
635
    {
636
        if ((string)$iterator === '0') {
637
            return null;
638
        }
639
        $this->init();
640
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
641
            $returned = $this->driver->sscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
642
            $iterator = $returned[0];
643
            return $returned[1];
644
        }
645
        return $this->driver->sscan($key, $iterator, $pattern, $count);
646
    }
647
648
    /**
649
     * Prepend one or multiple values to a list