| Conditions | 6 |
| Paths | 5 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 6.027 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 35 | 23 | public function get($key, $default = null) |
|
| 36 | { |
||
| 37 | 23 | $config = $this->config; |
|
| 38 | |||
| 39 | 23 | if (isset($config[$key])) { |
|
| 40 | 12 | return $config[$key]; |
|
| 41 | } |
||
| 42 | |||
| 43 | 19 | if (strpos($key, '.') === false) { |
|
| 44 | 19 | return $default; |
|
| 45 | } |
||
| 46 | |||
| 47 | 2 | foreach (explode('.', $key) as $segment) { |
|
| 48 | 2 | if (! is_array($config) || ! array_key_exists($segment, $config)) { |
|
| 49 | return $default; |
||
| 50 | } |
||
| 51 | 2 | $config = $config[$segment]; |
|
| 52 | } |
||
| 53 | |||
| 54 | 2 | return $config; |
|
| 55 | } |
||
| 81 |