| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2.0023 |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | 12 | public static function useInternalErrors(callable $callable) |
|
| 41 | { |
||
| 42 | 12 | $previousErrorReporting = error_reporting(); |
|
| 43 | 12 | error_reporting(0); |
|
| 44 | 12 | $previousLibXmlUseInternalErrors = libxml_use_internal_errors(true); |
|
| 45 | 12 | if ($previousLibXmlUseInternalErrors) { |
|
| 46 | libxml_clear_errors(); |
||
| 47 | } |
||
| 48 | 12 | $return = $callable(); |
|
| 49 | try { |
||
| 50 | 12 | static::throwFromLibXml(); |
|
| 51 | 11 | } finally { |
|
| 52 | 12 | error_reporting($previousErrorReporting); |
|
| 53 | 12 | libxml_use_internal_errors($previousLibXmlUseInternalErrors); |
|
| 54 | } |
||
| 55 | 11 | return $return; |
|
| 56 | } |
||
| 57 | } |
||
| 58 |