ConfigTrait::has()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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
}