Code Duplication    Length = 13-13 lines in 3 locations

src/RedisProxy.php 3 locations

@@ 343-355 (lines=13) @@
340
     * @param int $count
341
     * @return array|boolean|null list of found keys, returns null if $iterator is 0 or '0'
342
     */
343
    public function scan(&$iterator, $pattern = null, $count = null)
344
    {
345
        if ((string)$iterator === '0') {
346
            return null;
347
        }
348
        $this->init();
349
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
350
            $returned = $this->driver->scan($iterator, ['match' => $pattern, 'count' => $count]);
351
            $iterator = $returned[0];
352
            return $returned[1];
353
        }
354
        return $this->driver->scan($iterator, $pattern, $count);
355
    }
356
357
    /**
358
     * Get the value of a hash field
@@ 453-465 (lines=13) @@
450
     * @param int $count
451
     * @return array|boolean|null list of found fields with associated values, returns null if $iterator is 0 or '0'
452
     */
453
    public function hscan($key, &$iterator, $pattern = null, $count = null)
454
    {
455
        if ((string)$iterator === '0') {
456
            return null;
457
        }
458
        $this->init();
459
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
460
            $returned = $this->driver->hscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
461
            $iterator = $returned[0];
462
            return $returned[1];
463
        }
464
        return $this->driver->hscan($key, $iterator, $pattern, $count);
465
    }
466
467
    /**
468
     * Add one or more members to a set
@@ 513-525 (lines=13) @@
510
     * @param int $count
511
     * @return array|boolean|null list of found members, returns null if $iterator is 0 or '0'
512
     */
513
    public function sscan($key, &$iterator, $pattern = null, $count = null)
514
    {
515
        if ((string)$iterator === '0') {
516
            return null;
517
        }
518
        $this->init();
519
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
520
            $returned = $this->driver->sscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
521
            $iterator = $returned[0];
522
            return $returned[1];
523
        }
524
        return $this->driver->sscan($key, $iterator, $pattern, $count);
525
    }
526
527
    /**
528
     * Prepend one or multiple values to a list