AbstractQueueStoreConnection   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 47
ccs 8
cts 8
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A disconnect() 0 3 1
A getConfigurationValue() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace Da\Mailer\Queue\Backend;
4
5
use Da\Mailer\Helper\ArrayHelper;
6
7
abstract class AbstractQueueStoreConnection
8
{
9
    /**
10
     * @var mixed the internal connection instance (ie. PDO)
11
     */
12
    protected $instance;
13
/**
14
     * @var array
15
     */
16
    protected $configuration = [];
17
/**
18
     * AbstractQueueStoreConnection constructor.
19
     *
20
     * @param array $configuration
21
     */
22 12
    protected function __construct(array $configuration = [])
23
    {
24 12
        $this->configuration = $configuration;
25 12
    }
26
27
    /**
28
     * @param $key
29
     * @param null $default
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $default is correct as it would always require null to be passed?
Loading history...
30
     *
31
     * @return mixed
32
     */
33 13
    protected function getConfigurationValue($key, $default = null)
34
    {
35 13
        return ArrayHelper::getValue($this->configuration, $key, $default);
36
    }
37
38
    /**
39
     * Disconnects previous connection.
40
     */
41 11
    public function disconnect()
42
    {
43 11
        $this->instance = null;
44 11
    }
45
46
    /**
47
     * @return AbstractQueueStoreConnection
48
     */
49
    abstract public function connect();
50
/**
51
     * @return mixed
52
     */
53
    abstract public function getInstance();
54
}
55