ConfigAwareTrait::setConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Ps2alerts\Api\Contract;
4
5
trait ConfigAwareTrait
6
{
7
    /**
8
     * Holds Config Array
9
     *
10
     * @var array
11
     */
12
    protected $config;
13
14
    /**
15
     * Sets the Config
16
     *
17
     * @param array $config
18
     */
19
    public function setConfig(array $config)
20
    {
21
        $this->config = $config;
22
    }
23
24
    /**
25
     * Gets the config
26
     *
27
     * @return array
28
     */
29
    public function getConfig()
30
    {
31
        return $this->config;
32
    }
33
34
    /**
35
     * Gets the config item from the config array
36
     *
37
     * @param  string $key
38
     * @return string
39
     */
40
    public function getConfigItem($key)
41
    {
42
        if (array_key_exists($key, $this->config)) {
43
            return $this->config[$key];
44
        }
45
    }
46
}
47