} /**
* Renders the given exception.
*
* As this method is mainly called during boot where nothing is yet available,
* the output is always either HTML or CLI depending where PHP runs.
*/
private function renderException(\Throwable
$exception): void
{ $renderer = \
in_array(\PHP_SAPI,
['cli', 'phpdbg'
], true
) ?
new CliErrorRenderer() :
new HtmlErrorRenderer($this->debug
);
$exception =
$renderer->
render($exception);
if (!
headers_sent()) { http_response_code($exception->
getStatusCode());
foreach ($exception->
getHeaders() as $name =>
$value) { header($name.': '.
$value, false
);
} }