Terminate
in package
Table of Contents
- $exception : mixed
- $exitHandler : mixed
- $statusCode : mixed
- __construct() : mixed
- exit() : void
- Handles termination of the script execution by sending an HTTP status code, displaying an error page, and logging the exception.
- isValidHttpStatusCode() : bool
- Checks if the provided status code is a valid HTTP status code.
- logException() : void
- Handles exceptions by sending them to a monitoring tool.
- outputDebugInfo() : void
- Outputs detailed debug information if in a non-production environment.
- renderPage() : void
- Renders the error page with a given message and status code.
- sendHttpStatusCode() : void
- Sends the HTTP status code header after validating it.
- pageFooter() : void
- pageHeader() : void
- pageStyles() : void
Properties
$exception
protected
mixed
$exception
$exitHandler
protected
mixed
$exitHandler
$statusCode
protected
mixed
$statusCode
Methods
__construct()
public
__construct(Throwable $exception[, int $statusCode = 500 ][, ExitInterface|null $exit = null ]) : mixed
Parameters
- $exception : Throwable
- $statusCode : int = 500
- $exit : ExitInterface|null = null
Return values
mixed —exit()
Handles termination of the script execution by sending an HTTP status code, displaying an error page, and logging the exception.
public
static exit(Throwable $exception[, int|null $statusCode = 500 ]) : void
Parameters
- $exception : Throwable
-
The exception to log.
- $statusCode : int|null = 500
Return values
void —isValidHttpStatusCode()
Checks if the provided status code is a valid HTTP status code.
protected
static isValidHttpStatusCode(int $statusCode) : bool
Parameters
- $statusCode : int
-
The HTTP status code to validate.
Return values
bool —True if the status code is valid, false otherwise.
logException()
Handles exceptions by sending them to a monitoring tool.
protected
logException([Throwable $exception = null ]) : void
Parameters
- $exception : Throwable = null
-
The caught exception.
Return values
void —outputDebugInfo()
Outputs detailed debug information if in a non-production environment.
protected
outputDebugInfo() : void
Return values
void —renderPage()
Renders the error page with a given message and status code.
protected
renderPage() : void
Return values
void —sendHttpStatusCode()
Sends the HTTP status code header after validating it.
protected
sendHttpStatusCode() : void
Tags
Return values
void —pageFooter()
private
pageFooter() : void
Return values
void —pageHeader()
private
pageHeader([string $pageTitle = 'Service Unavailable' ]) : void
Parameters
- $pageTitle : string = 'Service Unavailable'
Return values
void —pageStyles()
private
static pageStyles() : void