Terminate
in package
Table of Contents
- $errorCode : mixed
- $exception : mixed
- $exitHandler : mixed
- $request : 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.
- exitHandler() : ExitInterface
- renderPage() : void
- Renders the error page with a given message and status code.
- setErrorCode() : void
- homeUrl() : string
- isValidHttpStatusCode() : bool
- Checks if the provided status code is a valid HTTP status code.
- linkUrl() : string
- logException() : void
- Handles exceptions by sending them to a monitoring tool.
- loginUrl() : string|null
- outputDebugInfo() : void
- Outputs detailed debug information if in a non-production environment.
- sendHttpStatusCode() : void
- Sends the HTTP status code header after validating it.
- showStackTrace() : bool
- Determines whether to display a stack trace.
- pageFooter() : void
- pageHeader() : void
- pageStyles() : void
Properties
$errorCode
protected
mixed
$errorCode
$exception
protected
mixed
$exception
$exitHandler
protected
mixed
$exitHandler
$request
protected
mixed
$request
$statusCode
protected
mixed
$statusCode
Methods
__construct()
public
__construct(Throwable $exception[, int $statusCode = 500 ][, array<string|int, mixed> $request = [] ][, ExitInterface|null $exit = null ]) : mixed
Parameters
- $exception : Throwable
- $statusCode : int = 500
- $request : array<string|int, mixed> = []
- $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 ][, string $pageTitle = 'Service Unavailable' ][, array<string|int, mixed> $request = [] ]) : void
Parameters
- $exception : Throwable
-
The exception to log.
- $statusCode : int|null = 500
- $pageTitle : string = 'Service Unavailable'
- $request : array<string|int, mixed> = []
Return values
void —exitHandler()
public
exitHandler() : ExitInterface
Return values
ExitInterface —renderPage()
Renders the error page with a given message and status code.
public
renderPage(string $pageTitle) : void
Parameters
- $pageTitle : string
Return values
void —setErrorCode()
public
setErrorCode(int $errorCode) : void
Parameters
- $errorCode : int
Return values
void —homeUrl()
protected
homeUrl() : string
Return values
string —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.
linkUrl()
protected
linkUrl() : string
Return values
string —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 —loginUrl()
protected
loginUrl() : string|null
Return values
string|null —outputDebugInfo()
Outputs detailed debug information if in a non-production environment.
protected
outputDebugInfo() : void
Return values
void —sendHttpStatusCode()
Sends the HTTP status code header after validating it.
protected
sendHttpStatusCode() : void
Tags
Return values
void —showStackTrace()
Determines whether to display a stack trace.
protected
static showStackTrace() : bool
This method checks various conditions to decide if a stack trace should be
shown. If the application is in a production environment, the stack trace
will not be displayed. Otherwise, it considers the terminate.debugger
configuration value or whether the application is not in a production
environment to make the determination.
Return values
bool —True if the stack trace should be displayed, false otherwise.
pageFooter()
private
pageFooter() : void
Return values
void —pageHeader()
private
pageHeader(string $pageTitle) : void
Parameters
- $pageTitle : string
Return values
void —pageStyles()
private
static pageStyles() : void