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

ConfigTrait::setConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
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