Aplus Framework Docs

ExceptionHandler
in package

Class ExceptionHandler.

Table of Contents

Constants

DEVELOPMENT  : string = 'development'
Development environment.
PRODUCTION  : string = 'production'
Production environment.

Properties

$developmentView  : string
$environment  : string
$hiddenInputs  : array<string|int, string>
$jsonFlags  : int
$language  : Language
$logger  : Logger|null
$productionView  : string
$searchEngines  : SearchEngines
$showLogId  : bool
$testing  : bool

Methods

__construct()  : mixed
ExceptionHandler constructor.
addHiddenInputs()  : static
errorHandler()  : bool
Error handler.
exceptionHandler()  : void
Exception handler.
getDevelopmentView()  : string
getEnvironment()  : string
getHiddenInputs()  : array<string|int, string>
getJsonFlags()  : int
getLanguage()  : Language
getLog()  : Log|null
Get the last log if it is showing log id and logger is set.
getLogger()  : Logger|null
getProductionView()  : string
getSearchEngines()  : SearchEngines
initialize()  : void
isHiddenInput()  : bool
isShowingLogId()  : bool
Tells if the log id is being shown.
removeHiddenInputs()  : static
setDevelopmentView()  : static
setEnvironment()  : static
setHiddenInputs()  : static
setJsonFlags()  : static
setLanguage()  : static
setProductionView()  : static
setSearchEngines()  : static
setShowLogId()  : static
Sets whether the log id will be shown in the production view.
acceptJson()  : bool
cliError()  : void
isCli()  : bool
isJson()  : bool
log()  : void
makeHiddenInputs()  : array<string|int, string>
reorderHiddenInputs()  : static
sendHeaders()  : void
sendJson()  : void
validateInputName()  : void
validateView()  : string

Constants

DEVELOPMENT

Development environment.

public string DEVELOPMENT = 'development'

PRODUCTION

Production environment.

public string PRODUCTION = 'production'

Properties

$developmentView

protected string $developmentView = __DIR__ . '/Views/exceptions/development.php'

$environment

protected string $environment = \Framework\Debug\ExceptionHandler::PRODUCTION

$jsonFlags

protected int $jsonFlags = \JSON_THROW_ON_ERROR | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE

$productionView

protected string $productionView = __DIR__ . '/Views/exceptions/production.php'

Methods

addHiddenInputs()

public addHiddenInputs(string $hiddenInput, string ...$hiddenInputs) : static
Parameters
$hiddenInput : string
$hiddenInputs : string
Tags
since
4.5
Return values
static

errorHandler()

Error handler.

public errorHandler(int $errno, string $errstr[, string|null $errfile = null ][, int|null $errline = null ]) : bool
Parameters
$errno : int

The level of the error raised

$errstr : string

The error message

$errfile : string|null = null

The filename that the error was raised in

$errline : int|null = null

The line number where the error was raised

Tags
see
http://php.net/manual/en/function.set-error-handler.php
throws
ErrorException

if the error is included in the error_reporting

Return values
bool

exceptionHandler()

Exception handler.

public exceptionHandler(Throwable $exception) : void
Parameters
$exception : Throwable

The Throwable, exception, instance

Tags
throws
RuntimeException

if view file is not found

getDevelopmentView()

public getDevelopmentView() : string
Return values
string

getHiddenInputs()

public getHiddenInputs() : array<string|int, string>
Tags
since
4.5
Return values
array<string|int, string>

getLog()

Get the last log if it is showing log id and logger is set.

public getLog() : Log|null
Return values
Log|null

getProductionView()

public getProductionView() : string
Return values
string

initialize()

public initialize([bool $handleErrors = true ]) : void
Parameters
$handleErrors : bool = true

isHiddenInput()

public isHiddenInput(string $name) : bool
Parameters
$name : string
Tags
since
4.5
Return values
bool

isShowingLogId()

Tells if the log id is being shown.

public isShowingLogId() : bool
Tags
since
4.4
Return values
bool

removeHiddenInputs()

public removeHiddenInputs(string $hiddenInput, string ...$hiddenInputs) : static
Parameters
$hiddenInput : string
$hiddenInputs : string
Tags
since
4.5
Return values
static

setDevelopmentView()

public setDevelopmentView(string $file) : static
Parameters
$file : string
Return values
static

setEnvironment()

public setEnvironment(string $environment) : static
Parameters
$environment : string
Return values
static

setHiddenInputs()

public setHiddenInputs(string $hiddenInput, string ...$hiddenInputs) : static
Parameters
$hiddenInput : string
$hiddenInputs : string
Tags
since
4.5
Return values
static

setJsonFlags()

public setJsonFlags(int $flags) : static
Parameters
$flags : int
Return values
static

setProductionView()

public setProductionView(string $file) : static
Parameters
$file : string
Return values
static

setShowLogId()

Sets whether the log id will be shown in the production view.

public setShowLogId([bool $showLogId = true ]) : static
Parameters
$showLogId : bool = true

True to show. False to not show.

Tags
since
4.4
Return values
static

cliError()

protected cliError(Throwable $exception) : void
Parameters
$exception : Throwable

log()

protected log(string $message) : void
Parameters
$message : string

makeHiddenInputs()

protected makeHiddenInputs(array<string|int, string> $names) : array<string|int, string>
Parameters
$names : array<string|int, string>
Tags
since
4.5
Return values
array<string|int, string>

reorderHiddenInputs()

protected reorderHiddenInputs() : static
Tags
since
4.5
Return values
static

sendJson()

protected sendJson(Throwable $exception) : void
Parameters
$exception : Throwable

validateView()

protected validateView(string $file) : string
Parameters
$file : string
Return values
string

        
On this page

Search results