Conditions | 5 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php namespace Tarsana\Command\Config; |
||
23 | public function get(string $path = null) |
||
24 | { |
||
25 | if (null === $path) |
||
26 | return $this->data; |
||
27 | $keys = explode('.', $path); |
||
28 | $value = $this->data; |
||
29 | foreach ($keys as $key) { |
||
30 | if (!is_array($value) || !array_key_exists($key, $value)) |
||
31 | throw new \Exception("Unable to find a configuration value with path '{$path}'"); |
||
32 | $value = $value[$key]; |
||
33 | } |
||
34 | return $value; |
||
35 | } |
||
36 | } |
||
37 |