for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace WebComplete\mvc\errorHandler;
use Whoops\Run;
use Whoops\Handler\PrettyPageHandler;
class ErrorHandler
{
private $errorPagePath = '';
public function register()
(new Run())->pushHandler(\ENV === 'dev'
ENV
? new PrettyPageHandler()
: function () {
$errorPagePath = $this->getErrorPagePath();
if ($errorPagePath && \file_exists($errorPagePath)) {
echo \file_get_contents($errorPagePath);
} else {
echo 'System error';
}
})->register();
/**
* @return string
*/
public function getErrorPagePath(): string
return $this->errorPagePath;
* @param string $errorPagePath
public function setErrorPagePath(string $errorPagePath)
$this->errorPagePath = $errorPagePath;