Code Duplication    Length = 14-14 lines in 4 locations

src/RedisProxy.php 4 locations

@@ 219-232 (lines=14) @@
216
     * @param integer $count
217
     * @return array|null list of found keys, returns null if $iterator is 0 or '0'
218
     */
219
    public function scan(&$iterator, $pattern = null, $count = null)
220
    {
221
        if ((string)$iterator === '0') {
222
            return null;
223
        }
224
        $this->init();
225
        if ($this->driver instanceof Client) {
226
            $returned = $this->driver->scan($iterator, ['match' => $pattern, 'count' => $count]);
227
            $iterator = $returned[0];
228
            return $returned[1];
229
        }
230
        $data = $this->driver->scan($iterator, $pattern, $count);
231
        return $data === false ? null : $data;
232
    }
233
234
    /**
235
     * Get the value of a hash field
@@ 311-324 (lines=14) @@
308
     * @param integer $count
309
     * @return array|null list of found fields with associated values, returns null if $iterator is 0 or '0'
310
     */
311
    public function hscan($key, &$iterator, $pattern = null, $count = null)
312
    {
313
        if ((string)$iterator === '0') {
314
            return null;
315
        }
316
        $this->init();
317
        if ($this->driver instanceof Client) {
318
            $returned = $this->driver->hscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
319
            $iterator = $returned[0];
320
            return $returned[1];
321
        }
322
        $data = $this->driver->hscan($key, $iterator, $pattern, $count);
323
        return $data === false ? null : $data;
324
    }
325
326
    /**
327
     * Add one or more members to a set
@@ 372-385 (lines=14) @@
369
     * @param integer $count
370
     * @return array|null list of found members, returns null if $iterator is 0 or '0'
371
     */
372
    public function sscan($key, &$iterator, $pattern = null, $count = null)
373
    {
374
        if ((string)$iterator === '0') {
375
            return null;
376
        }
377
        $this->init();
378
        if ($this->driver instanceof Client) {
379
            $returned = $this->driver->sscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
380
            $iterator = $returned[0];
381
            return $returned[1];
382
        }
383
        $data = $this->driver->sscan($key, $iterator, $pattern, $count);
384
        return $data === false ? null : $data;
385
    }
386
387
    /**
388
     * Incrementally iterate sorted sets elements and associated scores
@@ 395-408 (lines=14) @@
392
     * @param integer $count
393
     * @return array|null list of found elements, returns null if $iterator is 0 or '0'
394
     */
395
    public function zscan($key, &$iterator, $pattern = null, $count = null)
396
    {
397
        if ((string)$iterator === '0') {
398
            return null;
399
        }
400
        $this->init();
401
        if ($this->driver instanceof Client) {
402
            $returned = $this->driver->zscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
403
            $iterator = $returned[0];
404
            return $returned[1];
405
        }
406
        $data = $this->driver->zscan($key, $iterator, $pattern, $count);
407
        return $data === false ? null : $data;
408
    }
409
410
    private function convertFalseToNull($result)
411
    {