Conditions | 4 |
Paths | 8 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
11 | 9 | public static function throwFromLibXml() |
|
12 | { |
||
13 | 9 | $errors = libxml_get_errors(); |
|
14 | 9 | if (count($errors)) { |
|
15 | 4 | libxml_clear_errors(); |
|
16 | } |
||
17 | 9 | $lastException = null; |
|
18 | /** @var \LibXMLError $error */ |
||
19 | 9 | foreach ($errors as $error) { |
|
20 | 4 | $current = new self($error->message, 0, $lastException); |
|
21 | 4 | $lastException = $current; |
|
22 | } |
||
23 | 9 | if (null !== $lastException) { |
|
24 | 4 | throw $lastException; |
|
25 | } |
||
26 | 8 | } |
|
27 | |||
55 |