Total Complexity | 5 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class Open implements ConfigProviderContract |
||
10 | { |
||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | private $config; |
||
15 | |||
16 | /** |
||
17 | * @codeCoverageIgnore |
||
18 | * |
||
19 | * @param string $configFilePath |
||
20 | */ |
||
21 | public function load(string $configFilePath = self::CONFIG_FILE_PATH) |
||
22 | { |
||
23 | $this->config = require $configFilePath; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | */ |
||
29 | public function get(string $key, $default = null) |
||
30 | { |
||
31 | $segments = explode('.', $key); |
||
32 | $data = $this->config; |
||
33 | |||
34 | foreach ($segments as $segment) { |
||
35 | if (empty($data[$segment])) { |
||
36 | return $default; |
||
37 | } |
||
38 | |||
39 | $data = $data[$segment]; |
||
40 | } |
||
41 | |||
42 | return $data; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @return array |
||
47 | */ |
||
48 | public function getVocabularyDirectories(): array |
||
51 | } |
||
52 | } |
||
53 |