Conditions | 5 |
Paths | 12 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 3 | Features | 1 |
1 | <?php |
||
33 | protected function parseFile(string $strConfigFile) : array |
||
34 | { |
||
35 | if (!file_exists($strConfigFile)) { |
||
36 | trigger_error('Config File (' . $strConfigFile . ') does not exist!', E_USER_WARNING); |
||
37 | } |
||
38 | |||
39 | $aNeon = null; |
||
40 | $strNeon = file_get_contents($strConfigFile); |
||
41 | if ($strNeon !== false) { |
||
42 | try { |
||
43 | $aNeon = Neon::decode($strNeon); |
||
44 | if (!is_array($aNeon)) { |
||
45 | trigger_error('Config file (' . $strConfigFile . ') does not contain config informations!', E_USER_ERROR); |
||
46 | } |
||
47 | } catch (\Exception $e) { |
||
48 | trigger_error('Invalid config file (' . $strConfigFile . '): ' . $e->getMessage(), E_USER_ERROR); |
||
49 | } |
||
50 | } |
||
51 | return $aNeon ?? []; |
||
52 | } |
||
54 |