BaseExceptionHandler
in package
AbstractYes
Provides common functions for exception handlers, especially around displaying the output.
Table of Contents
Properties
- $config : Exceptions
- Config for debug exceptions.
- $obLevel : int
- Nesting level of the output buffering mechanism
- $viewPath : string|null
- The path to the directory containing the cli and html error view directories.
Methods
- __construct() : mixed
- handle() : void
- The main entry point into the handler.
- collectVars() : array<string|int, mixed>
- Gathers the variables that will be made available to the view.
- describeMemory() : string
- Describes memory usage in real-world units. Intended for use with memory_get_usage, etc.
- highlightFile() : bool|string
- Creates a syntax-highlighted version of a PHP file.
- maskSensitiveData() : array<string|int, mixed>
- Mask sensitive data in the trace.
- render() : void
- Given an exception and status code will display the error to the client.
- maskData() : array<string|int, mixed>|object
Properties
$config
Config for debug exceptions.
protected
Exceptions
$config
$obLevel
Nesting level of the output buffering mechanism
protected
int
$obLevel
$viewPath
The path to the directory containing the cli and html error view directories.
protected
string|null
$viewPath
= null
Methods
__construct()
public
__construct(Exceptions $config) : mixed
Parameters
- $config : Exceptions
handle()
The main entry point into the handler.
public
abstract handle(Throwable $exception, RequestInterface $request, ResponseInterface $response, int $statusCode, int $exitCode) : void
Parameters
- $exception : Throwable
- $request : RequestInterface
- $response : ResponseInterface
- $statusCode : int
- $exitCode : int
collectVars()
Gathers the variables that will be made available to the view.
protected
collectVars(Throwable $exception, int $statusCode) : array<string|int, mixed>
Parameters
- $exception : Throwable
- $statusCode : int
Return values
array<string|int, mixed>describeMemory()
Describes memory usage in real-world units. Intended for use with memory_get_usage, etc.
protected
static describeMemory(int $bytes) : string
Parameters
- $bytes : int
Tags
Return values
stringhighlightFile()
Creates a syntax-highlighted version of a PHP file.
protected
static highlightFile(string $file, int $lineNumber[, int $lines = 15 ]) : bool|string
Parameters
- $file : string
- $lineNumber : int
- $lines : int = 15
Tags
Return values
bool|stringmaskSensitiveData()
Mask sensitive data in the trace.
protected
maskSensitiveData(array<string|int, mixed> $trace, array<string|int, mixed> $keysToMask[, string $path = '' ]) : array<string|int, mixed>
Parameters
- $trace : array<string|int, mixed>
- $keysToMask : array<string|int, mixed>
- $path : string = ''
Return values
array<string|int, mixed>render()
Given an exception and status code will display the error to the client.
protected
render(Throwable $exception, int $statusCode[, string|null $viewFile = null ]) : void
Parameters
- $exception : Throwable
- $statusCode : int
- $viewFile : string|null = null
maskData()
private
maskData(array<string|int, mixed>|object $args, array<string|int, mixed> $keysToMask[, string $path = '' ]) : array<string|int, mixed>|object
Parameters
- $args : array<string|int, mixed>|object
- $keysToMask : array<string|int, mixed>
- $path : string = ''