Code Duplication    Length = 13-13 lines in 3 locations

src/RedisProxy.php 3 locations

@@ 308-320 (lines=13) @@
305
     * @param int $count
306
     * @return array|boolean|null list of found keys, returns null if $iterator is 0 or '0'
307
     */
308
    public function scan(&$iterator, $pattern = null, $count = null)
309
    {
310
        if ((string)$iterator === '0') {
311
            return null;
312
        }
313
        $this->init();
314
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
315
            $returned = $this->driver->scan($iterator, ['match' => $pattern, 'count' => $count]);
316
            $iterator = $returned[0];
317
            return $returned[1];
318
        }
319
        return $this->driver->scan($iterator, $pattern, $count);
320
    }
321
322
    /**
323
     * Get the value of a hash field
@@ 418-430 (lines=13) @@
415
     * @param int $count
416
     * @return array|boolean|null list of found fields with associated values, returns null if $iterator is 0 or '0'
417
     */
418
    public function hscan($key, &$iterator, $pattern = null, $count = null)
419
    {
420
        if ((string)$iterator === '0') {
421
            return null;
422
        }
423
        $this->init();
424
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
425
            $returned = $this->driver->hscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
426
            $iterator = $returned[0];
427
            return $returned[1];
428
        }
429
        return $this->driver->hscan($key, $iterator, $pattern, $count);
430
    }
431
432
    /**
433
     * Add one or more members to a set
@@ 478-490 (lines=13) @@
475
     * @param int $count
476
     * @return array|boolean|null list of found members, returns null if $iterator is 0 or '0'
477
     */
478
    public function sscan($key, &$iterator, $pattern = null, $count = null)
479
    {
480
        if ((string)$iterator === '0') {
481
            return null;
482
        }
483
        $this->init();
484
        if ($this->actualDriver() === self::DRIVER_PREDIS) {
485
            $returned = $this->driver->sscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
486
            $iterator = $returned[0];
487
            return $returned[1];
488
        }
489
        return $this->driver->sscan($key, $iterator, $pattern, $count);
490
    }
491
492
    /**
493
     * Prepend one or multiple values to a list