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