for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Xervice\ExceptionHandler\Business\Handler;
use Xervice\ExceptionHandler\Business\Printer\ExceptionPrinterInterface;
class DefaultExceptionHandler implements ExceptionHandlerInterface
{
/**
* @var ExceptionPrinterInterface
*/
private $printer;
* @var bool
private $shutdownIfError;
* DefaultExceptionHandler constructor.
*
* @param ExceptionPrinterInterface $printer
* @param bool $shutdownIfError
public function __construct(
ExceptionPrinterInterface $printer,
bool $shutdownIfError
) {
$this->printer = $printer;
$this->shutdownIfError = $shutdownIfError;
}
* @param \Exception $exception
public function handleException(\Exception $exception): void
$this->printer->printExeption($exception);
$this->shutdownXervicelication();
protected function shutdownXervicelication(): void
if ($this->shutdownIfError) {
exit;
exit
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.