Code Duplication    Length = 13-13 lines in 4 locations

src/RedisProxy.php 4 locations

@@ 199-211 (lines=13) @@
196
     * @param integer $count
197
     * @return array|null list of found keys, returns null if $iterator is 0 or '0'
198
     */
199
    public function scan(&$iterator, $pattern = null, $count = null)
200
    {
201
        if ((string)$iterator === '0') {
202
            return null;
203
        }
204
        $this->init();
205
        if ($this->driver instanceof Client) {
206
            $returned = $this->driver->scan($iterator, ['match' => $pattern, 'count' => $count]);
207
            $iterator = $returned[0];
208
            return $returned[1];
209
        }
210
        return $this->driver->scan($iterator, $pattern, $count);
211
    }
212
213
    /**
214
     * Get the value of a hash field
@@ 250-262 (lines=13) @@
247
     * @param integer $count
248
     * @return array|null list of found fields with associated values, returns null if $iterator is 0 or '0'
249
     */
250
    public function hscan($key, &$iterator, $pattern = null, $count = null)
251
    {
252
        if ((string)$iterator === '0') {
253
            return null;
254
        }
255
        $this->init();
256
        if ($this->driver instanceof Client) {
257
            $returned = $this->driver->hscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
258
            $iterator = $returned[0];
259
            return $returned[1];
260
        }
261
        return $this->driver->hscan($key, $iterator, $pattern, $count);
262
    }
263
264
    /**
265
     * Add one or more members to a set
@@ 310-322 (lines=13) @@
307
     * @param integer $count
308
     * @return array|null list of found members, returns null if $iterator is 0 or '0'
309
     */
310
    public function sscan($key, &$iterator, $pattern = null, $count = null)
311
    {
312
        if ((string)$iterator === '0') {
313
            return null;
314
        }
315
        $this->init();
316
        if ($this->driver instanceof Client) {
317
            $returned = $this->driver->sscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
318
            $iterator = $returned[0];
319
            return $returned[1];
320
        }
321
        return $this->driver->sscan($key, $iterator, $pattern, $count);
322
    }
323
324
    /**
325
     * Incrementally iterate sorted sets elements and associated scores
@@ 332-344 (lines=13) @@
329
     * @param integer $count
330
     * @return array|null list of found elements, returns null if $iterator is 0 or '0'
331
     */
332
    public function zscan($key, &$iterator, $pattern = null, $count = null)
333
    {
334
        if ((string)$iterator === '0') {
335
            return null;
336
        }
337
        $this->init();
338
        if ($this->driver instanceof Client) {
339
            $returned = $this->driver->zscan($key, $iterator, ['match' => $pattern, 'count' => $count]);
340
            $iterator = $returned[0];
341
            return $returned[1];
342
        }
343
        return $this->driver->zscan($key, $iterator, $pattern, $count);
344
    }
345
346
    private function convertFalseToNull($result)
347
    {