AbstractAdapter::getAdapterOption()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace devtoolboxuk\storage\Adapter;
4
5
/**
6
 * Base Abstract Database Adapter.
7
 */
8
abstract class AbstractAdapter implements AdapterInterface
9
{
10
11
    protected $adapterOptions = [];
12
    protected $connection;
13
14
    public function __construct(array $options)
15
    {
16
        $this->setAdapterOptions($options);
17
    }
18
19
    public function getAdapterOptions()
20
    {
21
        return $this->adapterOptions;
22
    }
23
24
    public function setAdapterOptions(array $options)
25
    {
26
        $this->adapterOptions = $options;
27
        return $this;
28
    }
29
30
    public function getAdapterOption($name)
31
    {
32
        if (!$this->hasAdapterOption($name)) {
33
            return null;
34
        }
35
36
        return $this->adapterOptions[$name];
37
    }
38
39
    public function hasAdapterOption($name)
40
    {
41
        return isset($this->adapterOptions[$name]);
42
    }
43
44
}
45