Completed
Push — master ( 9eae13...e56856 )
by Antonio
04:26
created

RedisQueueStoreConnection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A connect() 0 7 1
A getInstance() 0 8 2
1
<?php
2
namespace Da\Mailer\Queue\Backend\Redis;
3
4
use Da\Mailer\Queue\Backend\AbstractQueueStoreConnection;
5
use Predis\Client;
6
7
class RedisQueueStoreConnection extends AbstractQueueStoreConnection
8
{
9
    /**
10
     * RedisQueueStoreConnection constructor.
11
     *
12
     * @param array $configuration
13
     *
14
     * @see https://github.com/nrk/predis/wiki/Connection-Parameters#list-of-connection-parameters for a full list
15
     * of connection parameters
16
     */
17 3
    public function __construct(array $configuration)
18
    {
19 3
        parent::__construct($configuration);
20 3
    }
21
22
    /**
23
     * @return RedisQueueStoreConnection
24
     */
25 2
    public function connect()
26
    {
27 2
        $this->disconnect();
28 2
        $this->instance = new Client($this->configuration);
29
30 2
        return $this;
31
    }
32
33
    /**
34
     * Returns the client predis instance.
35
     *
36
     * @return Client
37
     */
38 1
    public function getInstance()
39
    {
40 1
        if ($this->instance === null) {
41 1
            $this->connect();
42 1
        }
43
44 1
        return $this->instance;
45
    }
46
}
47