Completed
Push — master ( a45e07...0294bf )
by Agel_Nash
02:52
created

ConfigTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 25
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setConfig() 0 5 1
A getConfig() 0 3 3
1
<?php namespace AgelxNash\Modx\Evo\Database\Traits;
2
3
trait ConfigTrait
4
{
5
    /**
6
     * @var array
7
     */
8
    protected $config = [];
9
10
    /**
11
     * @param null|string $key
12
     * @return mixed
13
     */
14 68
    public function getConfig($key = null)
15
    {
16 68
        return ($key === null ? $this->config : (isset($this->config[$key]) ? $this->config[$key] : null));
17
    }
18
19
    /**
20
     * @param $data
21
     * @return $this
22
     */
23 68
    public function setConfig($data)
24
    {
25 68
        $this->config = $data;
26
27 68
        return $this;
28
    }
29
}
30