Constants

DONE

DONE = 16

LAST_HANDLER

LAST_HANDLER = 32

The Handler has handled the Throwable in some way, and wishes to skip any other Handler.

Execution will continue.

QUIT

QUIT = 48

The Handler has handled the Throwable in some way, and wishes to quit/stop execution

Properties

$editor

$editor : mixed

A string identifier for a known IDE/text editor, or a closure that resolves a string that can be used to open a given file in an editor. If the string contains the special substrings %file or %line, they will be replaced with the correct data.

Type

mixed

$editors

$editors : array

A list of known editor strings

Type

array

$exception

$exception : \Throwable

Type

\Throwable

$searchPaths

$searchPaths : array

Search paths to be scanned for resources, in the reverse order they're declared.

Type

array

$resourceCache

$resourceCache : array

Fast lookup cache for known resource locations.

Type

array

$customCss

$customCss : string

The name of the custom css file.

Type

string

$extraTables

$extraTables : array<mixed,array>

Type

array<mixed,array>

$handleUnconditionally

$handleUnconditionally : boolean

Type

boolean

$pageTitle

$pageTitle : string

Type

string

$applicationPaths

$applicationPaths : array<mixed,array>

Type

array<mixed,array>

$blacklist

$blacklist : array<mixed,array>

Type

array<mixed,array>

Methods

setException()

setException(\Throwable  $exception) : void

Parameters

\Throwable $exception

__construct()

__construct() 

Constructor.

handle()

handle() : integer|null

Returns

integer|null

contentType()

contentType() : string

Returns

string

addDataTable()

addDataTable(string  $label, array  $data) 

Adds an entry to the list of tables displayed in the template.

The expected data is a simple associative array. Any nested arrays will be flattened with print_r

Parameters

string $label
array $data

addDataTableCallback()

addDataTableCallback(string  $label, callable  $callback) 

Lazily adds an entry to the list of tables displayed in the table.

The supplied callback argument will be called when the error is rendered, it should produce a simple associative array. Any nested arrays will be flattened with print_r.

Parameters

string $label
callable $callback

Callable returning an associative array

Throws

\InvalidArgumentException

If $callback is not callable

getDataTables()

getDataTables(string|null  $label = null) : array<mixed,array>|callable

Returns all the extra data tables registered with this handler.

Optionally accepts a 'label' parameter, to only return the data table under that label.

Parameters

string|null $label

Returns

array<mixed,array>|callable

handleUnconditionally()

handleUnconditionally(boolean|null  $value = null) : boolean|null

Allows to disable all attempts to dynamically decide whether to handle or return prematurely.

Set this to ensure that the handler will perform no matter what.

Parameters

boolean|null $value

Returns

boolean|null

addEditor()

addEditor(string  $identifier, string  $resolver) 

Adds an editor resolver, identified by a string name, and that may be a string path, or a callable resolver. If the callable returns a string, it will be set as the file reference's href attribute.

Parameters

string $identifier
string $resolver

Examples

"mvim://open?url=file://%file&line=%line")
** File not found : $run->addEditor('macvim', **
function($file, $line) { unlink($file); return "http://stackoverflow.com"; });
** File not found : $run->addEditor('remove-it', **

setEditor()

setEditor(string|callable  $editor) 

Set the editor to use to open referenced files, by a string identifier, or a callable that will be executed for every file reference, with a $file and $line argument, and should return a string.

Parameters

string|callable $editor

Throws

\InvalidArgumentException

If invalid argument identifier provided

Examples

$line) { return "file:///{$file}"; });
** File not found : $run->setEditor(function($file, **
** File not found : $run->setEditor('sublime'); **

getEditorHref()

getEditorHref(string  $filePath, integer  $line) : string|boolean

Given a string file path, and an integer file line, executes the editor resolver and returns, if available, a string that may be used as the href property for that file reference.

Parameters

string $filePath
integer $line

Throws

\InvalidArgumentException

If editor resolver does not return a string

Returns

string|boolean

getEditorAjax()

getEditorAjax(string  $filePath, integer  $line) : boolean

Given a boolean if the editor link should act as an Ajax request. The editor must be a valid callable function/closure

Parameters

string $filePath
integer $line

Throws

\UnexpectedValueException

If editor resolver does not return a boolean

Returns

boolean

setPageTitle()

setPageTitle(string  $title) : void

Parameters

string $title

getPageTitle()

getPageTitle() : string

Returns

string

addResourcePath()

addResourcePath(string  $path) : void

Adds a path to the list of paths to be searched for resources.

Parameters

string $path

Throws

\InvalidArgumentException

If $path is not a valid directory

addCustomCss()

addCustomCss(string  $name) : void

Adds a custom css file to be loaded.

Parameters

string $name

getResourcePaths()

getResourcePaths() : array

Returns

array

getResourcesPath()

getResourcesPath() : string

Returns

string

setResourcesPath()

setResourcesPath(string  $resourcesPath) : void

Parameters

string $resourcesPath

getApplicationPaths()

getApplicationPaths() : array

Return the application paths.

Returns

array

setApplicationPaths()

setApplicationPaths(array  $applicationPaths) 

Set the application paths.

Parameters

array $applicationPaths

setApplicationRootPath()

setApplicationRootPath(string  $applicationRootPath) 

Set the application root path.

Parameters

string $applicationRootPath

blacklist()

blacklist(  $superGlobalName,   $key) 

blacklist a sensitive value within one of the superglobal arrays.

Parameters

$superGlobalName

string the name of the superglobal array, e.g. '_GET'

$key

string the key within the superglobal

getException()

getException() : \Throwable

Returns

\Throwable

getExceptionFrames()

getExceptionFrames() : \Whoops\Exception\FrameCollection;

Get the stack trace frames of the exception that is currently being handled.

Returns

\Whoops\Exception\FrameCollection;

getExceptionCode()

getExceptionCode() : string

Get the code of the exception that is currently being handled.

Returns

string

getEditor()

getEditor(string  $filePath, integer  $line) : array

Given a boolean if the editor link should act as an Ajax request. The editor must be a valid callable function/closure

Parameters

string $filePath
integer $line

Returns

array

getResource()

getResource(string  $resource) : string

Finds a resource, by its relative path, in all available search paths.

The search is performed starting at the last search path, and all the way back to the first, enabling a cascading-type system of overrides for all resources.

Parameters

string $resource

Throws

\RuntimeException

If resource cannot be found in any of the available paths

Returns

string

masked()

masked(  $superGlobal,   $superGlobalName) : array

Checks all values within the given superGlobal array.

Blacklisted values will be replaced by a equal length string cointaining only '*' characters.

We intentionally dont rely on $GLOBALS as it depends on 'auto_globals_jit' php.ini setting.

Parameters

$superGlobal

array One of the superglobal arrays

$superGlobalName

string the name of the superglobal array, e.g. '_GET'

Returns

array —

$values without sensitive data