Completed
Push — master ( 8a4865...37eadf )
by Korotkov
03:55
created

ContainerConfigTrait::config()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 2
1
<?php
2
3
declare(strict_types = 1);
4
5
/**
6
 * @author    : Korotkov Danila <[email protected]>
7
 * @copyright Copyright (c) 2017, Korotkov Danila
8
 * @license   http://www.gnu.org/licenses/gpl.html GNU GPLv3.0
9
 */
10
11
namespace Rudra;
12
13
/**
14
 * Class ContainerConfigTrait
15
 *
16
 * @package Rudra
17
 */
18
trait ContainerConfigTrait
19
{
20
21
    /**
22
     * @var array
23
     */
24
    protected $config = [];
25
26
    /**
27
     * @param string      $key
28
     * @param string|null $subKey
29
     *
30
     * @return array|mixed
31
     */
32
    public function config(string $key, string $subKey = null)
33
    {
34
        return ($subKey === null) ? $this->config[$key] : $this->config[$key][$subKey];
35
    }
36
37
    /**
38
     * @param array $config
39
     */
40
    public function setConfig(array $config)
41
    {
42
        $this->config = $config;
43
    }
44
}
45