Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public function get($key, $default = null) |
||
24 | { |
||
25 | if (!is_string($key)) { |
||
26 | throw new \InvalidArgumentException( |
||
27 | sprintf('$key can only be string, got %s', var_export($key, true) |
||
28 | )); |
||
29 | } |
||
30 | |||
31 | if (!array_key_exists($key, $this->data)) { |
||
32 | if (null === $default) { |
||
33 | throw new \OutOfBoundsException(sprintf('Unknown config "%s"', $key)); |
||
34 | } |
||
35 | |||
36 | return $default; |
||
37 | } |
||
38 | |||
39 | return $this->data[$key]; |
||
40 | } |
||
41 | |||
47 |