RedisQueueStoreConnection   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 8
c 1
b 0
f 1
dl 0
loc 37
ccs 12
cts 12
cp 1
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getInstance() 0 7 2
A connect() 0 5 1
1
<?php
2
3
namespace Da\Mailer\Queue\Backend\Redis;
4
5
use Da\Mailer\Queue\Backend\AbstractQueueStoreConnection;
6
use Predis\Client;
7
8
class RedisQueueStoreConnection extends AbstractQueueStoreConnection
9
{
10
    /**
11
     * RedisQueueStoreConnection constructor.
12
     *
13
     * @param array $configuration
14
     *
15
     * @see https://github.com/nrk/predis/wiki/Connection-Parameters#list-of-connection-parameters for a full list
16
     * of connection parameters
17 3
     */
18
    public function __construct(array $configuration)
19 3
    {
20 3
        parent::__construct($configuration);
21
    }
22
23
    /**
24
     * @return RedisQueueStoreConnection
25 2
     */
26
    public function connect()
27 2
    {
28 2
        $this->disconnect();
29
        $this->instance = new Client($this->configuration);
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