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
$language
protected
Language
$language
$logger
protected
Logger|null
$logger
= null
$productionView
protected
string
$productionView
= __DIR__ . '/Views/exceptions/production.php'
$testing
protected
bool
$testing
= false
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
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
Return values
bool —exceptionHandler()
Exception handler.
public
exceptionHandler(Throwable $exception) : void
Parameters
- $exception : Throwable
-
The Throwable, exception, instance
Tags
Return values
void —getDevelopmentView()
public
getDevelopmentView() : string
Return values
string —getEnvironment()
public
getEnvironment() : string
Return values
string —getLanguage()
public
getLanguage() : Language
Return values
Language —getLogger()
public
getLogger() : Logger|null
Return values
Logger|null —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 —setLanguage()
public
setLanguage([Language $language = null ]) : static
Parameters
- $language : Language = null
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 —isCli()
protected
isCli() : bool
Return values
bool —isJson()
protected
isJson() : bool
Return values
bool —log()
protected
log(string $message) : void
Parameters
- $message : string
Return values
void —sendHeaders()
protected
sendHeaders() : void
Return values
void —sendJson()
protected
sendJson(Throwable $exception) : void
Parameters
- $exception : Throwable
Return values
void —validateView()
protected
validateView(string $file) : string
Parameters
- $file : string