Completed
Push — master ( f4415a...651f7b )
by Anton
12s
created

Config::getData()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 1
dl 0
loc 13
ccs 6
cts 6
cp 1
crap 3
rs 9.8333
c 0
b 0
f 0
1
<?php
2
/**
3
 * Bluz Framework Component
4
 *
5
 * @copyright Bluz PHP Team
6
 * @link      https://github.com/bluzphp/framework
7
 */
8
9
declare(strict_types=1);
10
11
namespace Bluz\Config;
12
13
use Bluz\Common\Collection;
14
use Bluz\Common\Container\Container;
15
use Bluz\Common\Container\RegularAccess;
16
17
/**
18
 * Config
19
 *
20
 * @package  Bluz\Config
21
 * @author   Anton Shevchuk
22
 * @link     https://github.com/bluzphp/framework/wiki/Config
23
 */
24
class Config
25
{
26
    use Container;
27
    use RegularAccess;
28
29
    /**
30
     * Return configuration by key
31
     *
32
     * @param array $keys
33
     *
34
     * @return array|mixed
35
     * @throws ConfigException
36
     */
37 609
    public function get(...$keys)
38
    {
39
        // configuration is missed
40 609
        if (empty($this->container)) {
41
            throw new ConfigException('System configuration is missing');
42
        }
43
44 609
        if (!\count($keys)) {
45 2
            return $this->container;
46
        }
47
48 608
        return Collection::get($this->container, ...$keys);
49
    }
50
}
51