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

ContainerConfigTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

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