Aplus Framework Docs

ExceptionHandler
in package

Class ExceptionHandler.

Table of Contents

DEVELOPMENT  = 'development'
Development environment.
PRODUCTION  = 'production'
Production environment.
$developmentView  : string
$environment  : string
$language  : Language
$logger  : Logger|null
$productionView  : string
$testing  : bool
__construct()  : mixed
ExceptionHandler constructor.
errorHandler()  : bool
Error handler.
exceptionHandler()  : void
Exception handler.
getDevelopmentView()  : string
getEnvironment()  : string
getLanguage()  : Language
getLogger()  : Logger|null
getProductionView()  : string
initialize()  : void
setDevelopmentView()  : static
setEnvironment()  : static
setLanguage()  : static
setProductionView()  : static
cliError()  : void
isCli()  : bool
isJson()  : bool
log()  : void
sendHeaders()  : void
sendJson()  : 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

$productionView

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

Methods

__construct()

ExceptionHandler constructor.

public __construct([string $environment = ExceptionHandler::PRODUCTION ][, Logger|null $logger = null ][, Language|null $language = null ]) : mixed
Parameters
$environment : string = ExceptionHandler::PRODUCTION
$logger : Logger|null = null
$language : Language|null = null
Tags
throws
InvalidArgumentException

if environment is invalid

Return values
mixed

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

Return values
void

getDevelopmentView()

public getDevelopmentView() : string
Return values
string

getEnvironment()

public getEnvironment() : string
Return values
string

getProductionView()

public getProductionView() : string
Return values
string

initialize()

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

setDevelopmentView()

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

setEnvironment()

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

setProductionView()

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

cliError()

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

log()

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

sendJson()

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

validateView()

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

Search results