Handler
class Handler (View source)
Properties
protected ResponsePreparerInterface | $responsePreparer | The response preparer implementation. |
|
protected ExceptionDisplayerInterface | $plainDisplayer | The plain exception displayer. |
|
protected ExceptionDisplayerInterface | $debugDisplayer | The debug exception displayer. |
|
protected bool | $debug | Indicates if the application is in debug mode. |
|
protected array | $handlers | All of the register exception handlers. |
|
protected array | $handled | All of the handled error messages. |
Methods
Create a new error handler instance.
Register the exception / error handlers for the application.
Register the PHP error handler.
Register the PHP exception handler.
Register the PHP shutdown handler.
Handle a PHP error for the application.
Handle the PHP shutdown event.
Determine if the error type is fatal.
Determine if the given handler handles this exception.
Determine if the given handler type hints the exception.
Prepare the given response.
Determine if we are running in the console.
Set the debug level for the handler.
Details
void
__construct(ResponsePreparerInterface $responsePreparer, ExceptionDisplayerInterface $plainDisplayer, ExceptionDisplayerInterface $debugDisplayer, bool $debug = true)
Create a new error handler instance.
void
register(string $environment)
Register the exception / error handlers for the application.
protected void
registerErrorHandler()
Register the PHP error handler.
protected void
registerExceptionHandler()
Register the PHP exception handler.
protected void
registerShutdownHandler()
Register the PHP shutdown handler.
handleError(int $level, string $message, string $file = '', int $line = 0, array $context = array())
Handle a PHP error for the application.
Response
handleException(Exception $exception)
Handle an exception for the application.
void
handleUncaughtException(Exception $exception)
Handle an uncaught exception.
void
handleShutdown()
Handle the PHP shutdown event.
protected bool
isFatal(int $type)
Determine if the error type is fatal.
void
handleConsole(Exception $exception)
Handle a console exception.
protected void
callCustomHandlers(Exception $exception, bool $fromConsole = false)
Handle the given exception.
protected void
displayException(Exception $exception)
Display the given exception to the user.
protected bool
handlesException(Closure $handler, Exception $exception)
Determine if the given handler handles this exception.
protected bool
hints(ReflectionFunction $reflection, Exception $exception)
Determine if the given handler type hints the exception.
protected string
formatException(Exception $e)
Format an exception thrown by a handler.
void
error(Closure $callback)
Register an application error handler.
void
pushError(Closure $callback)
Register an application error handler at the bottom of the stack.
protected Response
prepareResponse(mixed $response)
Prepare the given response.
bool
runningInConsole()
Determine if we are running in the console.
void
setDebug(bool $debug)
Set the debug level for the handler.