ConfigAwareTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setConfig() 0 4 1
A getConfig() 0 4 1
A getConfigItem() 0 6 2
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