| Conditions | 4 |
| Paths | 1 |
| Total Lines | 9 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | public static function register(): void |
||
| 19 | { |
||
| 20 | register_shutdown_function(function (): void { |
||
| 21 | $message = error_get_last()['message'] ?? null; |
||
| 22 | if (!headers_sent() && $message && str_starts_with($message, 'Maximum execution time of')) { |
||
| 23 | header('content-type: application/json'); |
||
| 24 | http_response_code(500); |
||
| 25 | |||
| 26 | echo json_encode(['message' => $message], JSON_PRESERVE_ZERO_FRACTION | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
||
| 27 | } |
||
| 31 |