Code Duplication    Length = 13-13 lines in 3 locations

src/RedisProxy.php 3 locations

@@ 378-390 (lines=13) @@
375
     * @param int $count
376
     * @return array|boolean|null list of found keys, returns null if $iterator is 0 or '0'
377
     */
378
    public function scan(&$iterator, $pattern = null, $count = null)
379
    {
380
        if ((string)$iterator === '0') {
381
            return null;
382
        }
383
        $this->init();
384
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
385
            $returned = $this->driver->scan($iterator, ['match' => $pattern, 'count' => $count]);
386
            $iterator = $returned[0];
387
            return $returned[1];
388
        }
389
        return $this->driver->scan($iterator, $pattern, $count);
390
    }
391
392
    /**
393
     * Get the value of a hash field
@@ 488-500 (lines=13) @@
485
     * @param int $count
486
     * @return array|boolean|null list of found fields with associated values, returns null if $iterator is 0 or '0'
487
     */
488
    public function hscan($key, &$iterator, $pattern = null, $count = null)
489
    {
490
        if ((string)$iterator === '0') {
491
            return null;
492
        }
493
        $this->init();
494
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
495
            $returned = $this->driver->hscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
496
            $iterator = $returned[0];
497
            return $returned[1];
498
        }
499
        return $this->driver->hscan($key, $iterator, $pattern, $count);
500
    }
501
502
    /**
503
     * Add one or more members to a set
@@ 548-560 (lines=13) @@
545
     * @param int $count
546
     * @return array|boolean|null list of found members, returns null if $iterator is 0 or '0'
547
     */
548
    public function sscan($key, &$iterator, $pattern = null, $count = null)
549
    {
550
        if ((string)$iterator === '0') {
551
            return null;
552
        }
553
        $this->init();
554
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
555
            $returned = $this->driver->sscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
556
            $iterator = $returned[0];
557
            return $returned[1];
558
        }
559
        return $this->driver->sscan($key, $iterator, $pattern, $count);
560
    }
561
562
    /**
563
     * Prepend one or multiple values to a list