| Conditions | 9 |
| Paths | 24 |
| Total Lines | 22 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 90 |
| Changes | 0 | ||
| 1 | <?php |
||
| 85 | protected function parse(string $file, string $name): array |
||
| 86 | { |
||
| 87 | $type = pathinfo($file, PATHINFO_EXTENSION); |
||
| 88 | |||
| 89 | switch ($type) { |
||
| 90 | case 'php': |
||
|
1 ignored issue
–
show
|
|||
| 91 | $config = include $file; |
||
| 92 | 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 | return isset($config) && is_array($config) ? $this->set($config, strtolower($name)) : []; |
||
| 107 | } |
||
| 214 |