Raydium Framework

Terminate
in package

Table of Contents

USE_MODERN_PAGE  = 'USE_MODERN_ERROR_PAGE'
$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
getBrandName()  : string
getClientIp()  : string
getEnvironment()  : string
getHomeUrl()  : string
getJavaScriptReportData()  : false|string
Generate JavaScript-safe JSON data for the report functionality.
getLoginUrl()  : string|null
getPreviousExceptions()  : string
getRequestId()  : string
getRequestPath()  : string
getRetryUrl()  : string
getStatusLabel()  : string
getTimestamp()  : string
getUserAgentShort()  : string
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.
processTemplate()  : string
Replace tokens safely; never leak sensitive info in production.
renderLegacyPage()  : void
Legacy page rendering (existing functionality).
renderModernPage()  : void
Renders the modern error page using the HTML template file.
sendHttpStatusCode()  : void
Sends the HTTP status code header after validating it.
shouldUseModernPage()  : bool
Determines whether to use the modern page template.
showStackTrace()  : bool
Determines whether to display a stack trace.
genericMessage()  : string
getSafeMessage()  : string
Return a safe, user-facing message.
pageFooter()  : void
pageHeader()  : void
pageStyles()  : void

Constants

USE_MODERN_PAGE

public mixed USE_MODERN_PAGE = 'USE_MODERN_ERROR_PAGE'

Properties

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 —

renderPage()

Renders the error page with a given message and status code.

public renderPage(string $pageTitle) : void

Now supports both legacy and modern templates based on constant.

Parameters
$pageTitle : string
Return values
void —

setErrorCode()

public setErrorCode(int $errorCode) : void
Parameters
$errorCode : int
Return values
void —

getBrandName()

protected getBrandName() : string
Return values
string —

getClientIp()

protected getClientIp() : string
Return values
string —

getEnvironment()

protected getEnvironment() : string
Return values
string —

getHomeUrl()

protected getHomeUrl() : string
Return values
string —

getJavaScriptReportData()

Generate JavaScript-safe JSON data for the report functionality.

protected getJavaScriptReportData(string $safeMessage) : false|string
Parameters
$safeMessage : string
Return values
false|string —

getLoginUrl()

protected getLoginUrl() : string|null
Return values
string|null —

getPreviousExceptions()

protected getPreviousExceptions() : string
Return values
string —

getRequestId()

protected getRequestId() : string
Return values
string —

getRequestPath()

protected getRequestPath() : string
Return values
string —

getRetryUrl()

protected getRetryUrl() : string
Return values
string —

getStatusLabel()

protected getStatusLabel() : string
Return values
string —

getTimestamp()

protected getTimestamp() : string
Return values
string —

getUserAgentShort()

protected getUserAgentShort() : string
Return values
string —

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 —

processTemplate()

Replace tokens safely; never leak sensitive info in production.

protected processTemplate(string $template, string $pageTitle) : string
Parameters
$template : string
$pageTitle : string
Return values
string —

renderLegacyPage()

Legacy page rendering (existing functionality).

protected renderLegacyPage(string $pageTitle) : void
Parameters
$pageTitle : string
Return values
void —

renderModernPage()

Renders the modern error page using the HTML template file.

protected renderModernPage(string $pageTitle) : void
Parameters
$pageTitle : string
Return values
void —

sendHttpStatusCode()

Sends the HTTP status code header after validating it.

protected sendHttpStatusCode() : void
Tags
throws
InvalidArgumentException

If the status code is not valid.

Return values
void —

shouldUseModernPage()

Determines whether to use the modern page template.

protected shouldUseModernPage() : bool
Return values
bool —

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.

genericMessage()

private static genericMessage() : string
Return values
string —

getSafeMessage()

Return a safe, user-facing message.

private getSafeMessage(string $rawMessage, int $statusCode, bool $isProd) : string

In production, redact 5xx messages (which often contain sensitive info). For common 4xx, the original message is usually fine.

Parameters
$rawMessage : string
$statusCode : int
$isProd : bool
Return values
string —
private pageFooter() : void
Return values
void —

pageHeader()

private pageHeader(string $pageTitle) : void
Parameters
$pageTitle : string
Return values
void —

pageStyles()

private static pageStyles() : void
Return values
void —

Search results