Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
18 | public function get($route, $default = null) |
||
19 | { |
||
20 | $config = $this->config; |
||
21 | $routes = explode('.', $route); |
||
22 | $endPath = ''; |
||
23 | foreach ($routes as $item) { |
||
24 | $endPath .= $item . '.'; |
||
25 | if (!array_key_exists($item, $config)) { |
||
26 | if (null !== $default) { |
||
27 | |||
28 | return $default; |
||
29 | } |
||
30 | throw new \RuntimeException('Unknown config route and no default values: ' . $endPath); |
||
31 | } |
||
32 | $config = $config[$item]; |
||
33 | } |
||
34 | |||
35 | return $config; |
||
36 | } |
||
37 | |||
58 | } |