Conditions | 4 |
Paths | 4 |
Total Lines | 26 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
37 | function loadToml(string $path): array |
||
38 | { |
||
39 | $output = []; |
||
40 | $files = glob("{$path}/*.toml"); |
||
41 | |||
42 | foreach ($files as $file) |
||
43 | { |
||
44 | $key = str_replace('.toml', '', basename($file)); |
||
45 | $toml = file_get_contents($file); |
||
46 | $config = Toml::Parse($toml); |
||
47 | |||
48 | if ($key === 'config') |
||
49 | { |
||
50 | foreach($config as $name => $value) |
||
51 | { |
||
52 | $output[$name] = $value; |
||
53 | } |
||
54 | |||
55 | continue; |
||
56 | } |
||
57 | |||
58 | $output[$key] = $config; |
||
59 | } |
||
60 | |||
61 | return $output; |
||
62 | } |