| Total Complexity | 3 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Coverage | 86.67% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | abstract class WarningsIntoExceptions |
||
| 8 | { |
||
| 9 | |||
| 10 | 2 | public static function warningHandler($errno, $errstr, $errfile, $errline) |
|
| 11 | { |
||
| 12 | 2 | throw new WarningException( |
|
| 13 | 2 | 'A warning was issued', |
|
| 14 | 2 | 'A warning was issued: ' . ': ' . $errstr . ' in ' . $errfile . ', line ' . $errline . |
|
| 15 | 2 | ', PHP ' . PHP_VERSION . |
|
| 16 | 2 | ' (' . PHP_OS . ')' |
|
| 17 | 2 | ); |
|
| 18 | |||
| 19 | /* Don't execute PHP internal error handler */ |
||
| 20 | // return true; // commented out (unreachable) |
||
| 21 | } |
||
| 22 | |||
| 23 | 2 | public static function activate() |
|
| 24 | { |
||
| 25 | 2 | set_error_handler( |
|
| 26 | 2 | array('\\WebPConvert\\Helpers\\WarningsIntoExceptions', "warningHandler"), |
|
| 27 | 2 | E_WARNING | E_USER_WARNING |
|
| 28 | 2 | ); // E_USER_WARNING E_ALL |
|
| 29 | 2 | } |
|
| 30 | |||
| 31 | public static function deactivate() |
||
| 34 | } |
||
| 35 | } |
||
| 36 |