Code Duplication    Length = 13-13 lines in 3 locations

src/RedisProxy.php 3 locations

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