Conditions | 5 |
Paths | 6 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
7 | public function get($config, $default = null) |
||
8 | { |
||
9 | $keys = explode('.', $config); |
||
10 | $filename = array_shift($keys); |
||
11 | |||
12 | $data = include __DIR__ . "/../../../../../config/{$filename}.php"; |
||
13 | |||
14 | foreach ($keys as $key) { |
||
15 | if (is_array($data) && array_key_exists($key, $data)) { |
||
16 | $data = $data[$key]; |
||
17 | } else { |
||
18 | $data = null; |
||
19 | } |
||
20 | } |
||
21 | |||
22 | if (!$data) { |
||
23 | $data = $default; |
||
24 | } |
||
25 | |||
26 | return $data; |
||
27 | } |
||
28 | } |
||
29 |