RedisDriver   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 33
ccs 10
cts 10
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A rPush() 0 4 1
A lPop() 0 6 2
1
<?php
2
3
namespace Zenstruck\Queue\Driver;
4
5
/**
6
 * @author Kevin Bond <[email protected]>
7
 */
8
final class RedisDriver extends BaseRedisDriver
9
{
10
    private $client;
11
12
    /**
13
     * @param \Redis $client
14
     * @param string $queueName
15
     */
16 1
    public function __construct(\Redis $client, $queueName)
17
    {
18 1
        $this->client = $client;
19
20 1
        parent::__construct($queueName);
21 1
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26 1
    protected function rPush($queueName, $payload)
27
    {
28 1
        $this->client->rPush($queueName, $payload);
29 1
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 1
    protected function lPop($queueName)
35
    {
36 1
        $data = $this->client->lPop($queueName);
37
38 1
        return false === $data ? null : $data;
39
    }
40
}
41