| Conditions | 3 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | 8 | public function read() |
|
| 33 | { |
||
| 34 | 8 | $old = libxml_use_internal_errors(true); |
|
| 35 | 8 | $xml = simplexml_load_file($this->path); |
|
| 36 | 8 | $errors = libxml_get_errors(); |
|
| 37 | 8 | libxml_use_internal_errors($old); |
|
| 38 | |||
| 39 | 8 | if (count($errors) || $xml === false) { |
|
| 40 | 1 | throw new RuntimeException('xml file \'' . $this->path . '\': ' . $errors[0]->message); |
|
| 41 | } |
||
| 42 | 7 | return $xml; |
|
| 43 | } |
||
| 45 |