| Conditions | 3 |
| Paths | 5 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 6 | public function parse($path) |
|
| 29 | { |
||
| 30 | try { |
||
| 31 | // Check if the PHP native's YAML extension is exist |
||
| 32 | 6 | if (!extension_loaded('yaml')) { |
|
| 33 | 6 | $data = YamlParser::parse(file_get_contents($path)); |
|
| 34 | 2 | } else { |
|
| 35 | 1 | $data = yaml_parse_file($path); |
|
| 36 | } |
||
| 37 | 5 | } catch (Exception $ex) { |
|
| 38 | 3 | throw new ParseException([ |
|
| 39 | 3 | 'message' => 'Error parsing YAML file', |
|
| 40 | 3 | 'exception' => $ex, |
|
| 41 | 2 | ]); |
|
| 42 | } |
||
| 43 | |||
| 44 | 3 | return $data; |
|
| 45 | } |
||
| 46 | |||
| 57 |