Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2.0054 |
Changes | 0 |
1 | <?php |
||
40 | 9 | public static function useInternalErrors(callable $callable) |
|
41 | { |
||
42 | 9 | $previousLibXmlUseInternalErrors = libxml_use_internal_errors(true); |
|
43 | 9 | if ($previousLibXmlUseInternalErrors) { |
|
44 | libxml_clear_errors(); |
||
45 | } |
||
46 | 9 | $return = $callable(); |
|
47 | try { |
||
48 | 9 | static::throwFromLibXml(); |
|
49 | 8 | } finally { |
|
50 | 9 | libxml_use_internal_errors($previousLibXmlUseInternalErrors); |
|
51 | } |
||
52 | 8 | return $return; |
|
53 | } |
||
54 | } |
||
55 |