| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 24 | public function parse($path) |
||
| 25 | { |
||
| 26 | $data = simplexml_load_file($path, 'SimpleXMLElement', LIBXML_NOWARNING | LIBXML_NOERROR); |
||
| 27 | |||
| 28 | if ($data === false) { |
||
| 29 | $lastError = libxml_get_last_error(); |
||
| 30 | if ($lastError !== false) { |
||
| 31 | throw new ParseException([ |
||
| 32 | 'message' => $lastError->message, |
||
| 33 | 'type' => $lastError->level, |
||
| 34 | 'code' => $lastError->code, |
||
| 35 | 'file' => $lastError->file, |
||
| 36 | 'line' => $lastError->line, |
||
| 37 | ]); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 41 | $data = json_decode(json_encode($data), true); |
||
| 42 | |||
| 43 | return $data; |
||
| 44 | } |
||
| 45 | |||
| 56 |