ConfigTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setConfig() 0 4 1
A getConfig() 0 4 1
A has() 0 4 1
A get() 0 4 1
1
<?php
2
3
namespace Nopolabs\Yabot\Helpers;
4
5
6
trait ConfigTrait
7
{
8
    /** @var array */
9
    private $config = [];
10
11
    public function setConfig(array $config)
12
    {
13
        $this->config = $config;
14
    }
15
16
    protected function getConfig() : array
17
    {
18
        return $this->config;
19
    }
20
21
    protected function has($key) : bool
22
    {
23
        return isset($this->config[$key]);
24
    }
25
26
    protected function get($key, $default = null)
27
    {
28
        return $this->config[$key] ?? $default;
29
    }
30
}