Code Duplication    Length = 13-13 lines in 4 locations

src/RedisProxy.php 4 locations

@@ 231-243 (lines=13) @@
228
     * @param integer $count
229
     * @return array|null list of found keys, returns null if $iterator is 0 or '0'
230
     */
231
    public function scan(&$iterator, $pattern = null, $count = null)
232
    {
233
        if ((string)$iterator === '0') {
234
            return null;
235
        }
236
        $this->init();
237
        if ($this->driver instanceof Client) {
238
            $returned = $this->driver->scan($iterator, ['match' => $pattern, 'count' => $count]);
239
            $iterator = $returned[0];
240
            return $returned[1];
241
        }
242
        return $this->driver->scan($iterator, $pattern, $count);
243
    }
244
245
    /**
246
     * Get the value of a hash field
@@ 334-346 (lines=13) @@
331
     * @param integer $count
332
     * @return array|null list of found fields with associated values, returns null if $iterator is 0 or '0'
333
     */
334
    public function hscan($key, &$iterator, $pattern = null, $count = null)
335
    {
336
        if ((string)$iterator === '0') {
337
            return null;
338
        }
339
        $this->init();
340
        if ($this->driver instanceof Client) {
341
            $returned = $this->driver->hscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
342
            $iterator = $returned[0];
343
            return $returned[1];
344
        }
345
        return $this->driver->hscan($key, $iterator, $pattern, $count);
346
    }
347
348
    /**
349
     * Add one or more members to a set
@@ 394-406 (lines=13) @@
391
     * @param integer $count
392
     * @return array|null list of found members, returns null if $iterator is 0 or '0'
393
     */
394
    public function sscan($key, &$iterator, $pattern = null, $count = null)
395
    {
396
        if ((string)$iterator === '0') {
397
            return null;
398
        }
399
        $this->init();
400
        if ($this->driver instanceof Client) {
401
            $returned = $this->driver->sscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
402
            $iterator = $returned[0];
403
            return $returned[1];
404
        }
405
        return $this->driver->sscan($key, $iterator, $pattern, $count);
406
    }
407
408
    /**
409
     * Incrementally iterate sorted sets elements and associated scores
@@ 416-428 (lines=13) @@
413
     * @param integer $count
414
     * @return array|null list of found elements, returns null if $iterator is 0 or '0'
415
     */
416
    public function zscan($key, &$iterator, $pattern = null, $count = null)
417
    {
418
        if ((string)$iterator === '0') {
419
            return null;
420
        }
421
        $this->init();
422
        if ($this->driver instanceof Client) {
423
            $returned = $this->driver->zscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
424
            $iterator = $returned[0];
425
            return $returned[1];
426
        }
427
        return $this->driver->zscan($key, $iterator, $pattern, $count);
428
    }
429
430
    private function convertFalseToNull($result)
431
    {