| Conditions | 9 |
| Paths | 24 |
| Total Lines | 22 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 25.4838 |
| Changes | 0 | ||
| 1 | <?php |
||
| 85 | 1 | protected function parse(string $file, string $name): array |
|
| 86 | { |
||
| 87 | 1 | $type = pathinfo($file, PATHINFO_EXTENSION); |
|
| 88 | |||
| 89 | 1 | switch ($type) { |
|
| 90 | 1 | case 'php': |
|
|
1 ignored issue
–
show
|
|||
| 91 | 1 | $config = include $file; |
|
| 92 | 1 | break; |
|
| 93 | case 'yaml': |
||
|
1 ignored issue
–
show
|
|||
| 94 | if (function_exists('yaml_parse_file')) { |
||
|
1 ignored issue
–
show
|
|||
| 95 | $config = yaml_parse_file($file); |
||
| 96 | } |
||
|
1 ignored issue
–
show
|
|||
| 97 | break; |
||
| 98 | case 'ini': |
||
|
1 ignored issue
–
show
|
|||
| 99 | $config = parse_ini_file($file, true, INI_SCANNER_TYPED) ?: []; |
||
| 100 | break; |
||
| 101 | case 'json': |
||
|
1 ignored issue
–
show
|
|||
| 102 | $config = json_decode(file_get_contents($file), true); |
||
| 103 | break; |
||
| 104 | } |
||
| 105 | |||
| 106 | 1 | return isset($config) && is_array($config) ? $this->set($config, strtolower($name)) : []; |
|
| 107 | } |
||
| 192 |