Completed
Push — master ( f9b1b0...fdf88b )
by Adam
02:21
created

RedisDriver::push()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace Equip\Queue\Driver;
4
5
use Redis;
6
7
class RedisDriver implements DriverInterface
8
{
9
    /**
10
     * @var Redis
11
     */
12
    private $redis;
13
14
    /**
15
     * @param Redis $redis
16
     */
17
    public function __construct(Redis $redis)
18
    {
19
        $this->redis = $redis;
20
    }
21
22
    /**
23
     * @inheritdoc
24
     */
25
    public function enqueue($queue, $message)
26
    {
27
        return (bool) $this->redis->rPush($queue, $message);
28
    }
29
30
    /**
31
     * @inheritdoc
32
     */
33
    public function dequeue($queue)
34
    {
35
        list($_, $message) = $this->redis->blPop($queue, 5) ?: null;
1 ignored issue
show
Unused Code introduced by
The assignment to $_ is unused. Consider omitting it like so list($first,,$third).

This checks looks for assignemnts to variables using the list(...) function, where not all assigned variables are subsequently used.

Consider the following code example.

<?php

function returnThreeValues() {
    return array('a', 'b', 'c');
}

list($a, $b, $c) = returnThreeValues();

print $a . " - " . $c;

Only the variables $a and $c are used. There was no need to assign $b.

Instead, the list call could have been.

list($a,, $c) = returnThreeValues();
Loading history...
36
37
        return $message;
38
    }
39
}
40