WhoopsExceptionRenderer.php
TLDR
The WhoopsExceptionRenderer.php
file is a part of the Illuminate\Foundation\Exceptions\Whoops
namespace. It contains a class WhoopsExceptionRenderer
that implements the ExceptionRenderer
interface. This class is responsible for rendering exceptions as HTML using the Whoops library.
Methods
No methods available in this file.
Classes
No classes available in this file.
<?php
namespace Illuminate\Foundation\Exceptions\Whoops;
use Illuminate\Contracts\Foundation\ExceptionRenderer;
use Whoops\Run as Whoops;
use function tap;
class WhoopsExceptionRenderer implements ExceptionRenderer
{
/**
* Renders the given exception as HTML.
*
* @param \Throwable $throwable
* @return string
*/
public function render($throwable)
{
return tap(new Whoops, function ($whoops) {
$whoops->appendHandler($this->whoopsHandler());
$whoops->writeToOutput(false);
$whoops->allowQuit(false);
})->handleException($throwable);
}
/**
* Get the Whoops handler for the application.
*
* @return \Whoops\Handler\Handler
*/
protected function whoopsHandler()
{
return (new WhoopsHandler)->forDebug();
}
}