Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
37 | public static function read(string $sConfigFile): array |
||
38 | { |
||
39 | $sConfigFile = realpath($sConfigFile); |
||
40 | if(!is_readable($sConfigFile)) |
||
41 | { |
||
42 | throw new FileAccess($sConfigFile); |
||
43 | } |
||
44 | |||
45 | $sFileContent = file_get_contents($sConfigFile); |
||
46 | $aConfigOptions = json_decode($sFileContent, true); |
||
47 | if(!is_array($aConfigOptions)) |
||
48 | { |
||
49 | throw new FileContent($sConfigFile); |
||
50 | } |
||
51 | |||
52 | return $aConfigOptions; |
||
53 | } |
||
55 |