Conditions | 4 |
Paths | 6 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
29 | protected function parseFile(string $strConfigFile) : array |
||
30 | { |
||
31 | if (!file_exists($strConfigFile)) { |
||
32 | trigger_error('Config File (' . $strConfigFile . ') does not exist!', E_USER_WARNING); |
||
33 | } |
||
34 | |||
35 | $aJSON = null; |
||
36 | $strJson = file_get_contents($strConfigFile); |
||
37 | if ($strJson !== false) { |
||
38 | $aJSON = json_decode($strJson, true); |
||
39 | if ($aJSON === null) { |
||
40 | trigger_error('Invalid config file (' . $strConfigFile . '): ' . json_last_error_msg(), E_USER_ERROR); |
||
41 | } |
||
42 | } |
||
43 | return $aJSON ?? []; |
||
44 | } |
||
46 |