WhoopsRenderer extends ErrorRenderer
[abstract description].
Table of Contents
$searchPaths | Search paths to be scanned for resources, in the reverse order they're declared. | array |
---|---|---|
$resourceCache | Fast lookup cache for known resource locations. | array |
$customCss | The name of the custom css file. | string |
$extraTables | array[] | |
$handleUnconditionally | bool | |
$pageTitle | string | |
$applicationPaths | array[] | |
$blacklist | array[] | |
$editor | 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. | mixed |
$editors | A list of known editor strings. | array |
$inspector | Inspector | |
$templateHelper | TemplateHelper | |
$request | ServerRequestInterface | |
$response | ResponseInterface | |
$exception | Throwable | |
$displayErrorDetails | Tells the renderer whether or not to output detailed error information to the client. | bool |
__construct() | Create a new ErrorRenderer object. | mixed |
render() | string | |
addDataTable() | Adds an entry to the list of tables displayed in the template. | mixed |
addDataTableCallback() | Lazily adds an entry to the list of tables displayed in the table. | mixed |
blacklist() | blacklist a sensitive value within one of the superglobal arrays. | mixed |
getDataTables() | Returns all the extra data tables registered with this handler. | array[]|callable |
handleUnconditionally() | Allows to disable all attempts to dynamically decide whether to handle or return prematurely. | bool|null |
addEditor() | 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. | mixed |
setEditor() | 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. | mixed |
getEditorHref() | 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. | string|bool |
getEditorAjax() | Given a boolean if the editor link should act as an Ajax request. The editor must be a valid callable function/closure. | bool |
setPageTitle() | mixed | |
getPageTitle() | string | |
addResourcePath() | Adds a path to the list of paths to be searched for resources. | mixed |
addCustomCss() | Adds a custom css file to be loaded. | mixed |
getResourcePaths() | array | |
getResourcesPath() | string | |
setResourcesPath() | mixed | |
getApplicationPaths() | Return the application paths. | array |
setApplicationPaths() | Set the application paths. | mixed |
setApplicationRootPath() | Set the application root path. | mixed |
getEditor() | Given a boolean if the editor link should act as an Ajax request. The editor must be a valid callable function/closure. | array |
getException() | Throwable | |
getInspector() | Inspector | |
getResource() | Finds a resource, by its relative path, in all available search paths. | string |
masked() | Checks all values within the given superGlobal array. | array |
__construct() | Create a new ErrorRenderer object. | mixed |
render() | string | |
renderWithBody() | Body |
Properties
$searchPaths
Search paths to be scanned for resources, in the reverse order they're declared.
private
array
$searchPaths
= []
$resourceCache
Fast lookup cache for known resource locations.
private
array
$resourceCache
= []
$customCss
The name of the custom css file.
private
string
$customCss
= null
$extraTables
private
array[]
$extraTables
= []
$handleUnconditionally
private
bool
$handleUnconditionally
= false
$pageTitle
private
string
$pageTitle
= 'Whoops! There was an error.'
$applicationPaths
private
array[]
$applicationPaths
$blacklist
private
array[]
$blacklist
= ['_GET' => [], '_POST' => [], '_FILES' => [], '_COOKIE' => [], '_SESSION' => [], '_SERVER' => ['DB_PASSWORD', 'SMTP_PASSWORD'], '_ENV' => ['DB_PASSWORD', 'SMTP_PASSWORD']]
$editor
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.
protected
mixed
$editor
Tags
$editors
A list of known editor strings.
protected
array
$editors
= ['sublime' => 'subl://open?url=file://%file&line=%line', 'textmate' => 'txmt://open?url=file://%file&line=%line', 'emacs' => 'emacs://open?url=file://%file&line=%line', 'macvim' => 'mvim://open/?url=file://%file&line=%line', 'phpstorm' => 'phpstorm://open?file=%file&line=%line', 'idea' => 'idea://open?file=%file&line=%line']
$inspector
protected
Inspector
$inspector
$templateHelper
private
TemplateHelper
$templateHelper
$request
protected
ServerRequestInterface
$request
$response
protected
ResponseInterface
$response
$exception
protected
Throwable
$exception
$displayErrorDetails
Tells the renderer whether or not to output detailed error information to the client.
protected
bool
$displayErrorDetails
Methods
__construct()
Create a new ErrorRenderer object.
public
__construct(
$request :
ServerRequestInterface
, $response :
ResponseInterface
, $exception :
mixed
[, $displayErrorDetails :
mixed
= false ]
)
: mixed
Parameters
- $request : ServerRequestInterface
The most recent Request object
- $response : ResponseInterface
The most recent Response object
- $exception : mixed
The caught Exception object
- $displayErrorDetails : mixed = false
Return values
mixedrender()
public
render(
)
: string
Return values
stringaddDataTable()
Adds an entry to the list of tables displayed in the template.
public
addDataTable(
$label :
string
, $data :
array
)
: mixed
The expected data is a simple associative array. Any nested arrays will be flattened with print_r.
Parameters
- $label : string
- $data : array
Return values
mixedaddDataTableCallback()
Lazily adds an entry to the list of tables displayed in the table.
public
addDataTableCallback(
$label :
string
, $callback :
callable
)
: mixed
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
- $label : string
- $callback : callable
Callable returning an associative array
Tags
Return values
mixedblacklist()
blacklist a sensitive value within one of the superglobal arrays.
public
blacklist(
$superGlobalName :
string
, $key :
string
)
: mixed
Parameters
- $superGlobalName : string
The name of the superglobal array, e.g. '_GET'
- $key : string
The key within the superglobal
Return values
mixedgetDataTables()
Returns all the extra data tables registered with this handler.
public
getDataTables(
[ $label :
string|null
= null ]
)
: array[]|callable
Optionally accepts a 'label' parameter, to only return the data table under that label.
Parameters
- $label : string|null = null
Return values
array[]|callablehandleUnconditionally()
Allows to disable all attempts to dynamically decide whether to handle or return prematurely.
public
handleUnconditionally(
[ $value :
bool|null
= null ]
)
: bool|null
Set this to ensure that the handler will perform no matter what.
Parameters
- $value : bool|null = null
Return values
bool|nulladdEditor()
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.
public
addEditor(
$identifier :
string
, $resolver :
string
)
: mixed
Parameters
- $identifier : string
- $resolver : string
Tags
Return values
mixedsetEditor()
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.
public
setEditor(
$editor :
string|callable
)
: mixed
Parameters
- $editor : string|callable
Tags
Return values
mixedgetEditorHref()
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.
public
getEditorHref(
$filePath :
string
, $line :
int
)
: string|bool
Parameters
- $filePath : string
- $line : int
Tags
Return values
string|boolgetEditorAjax()
Given a boolean if the editor link should act as an Ajax request. The editor must be a valid callable function/closure.
public
getEditorAjax(
$filePath :
string
, $line :
int
)
: bool
Parameters
- $filePath : string
- $line : int
Tags
Return values
boolsetPageTitle()
public
setPageTitle(
$title :
string
)
: mixed
Parameters
- $title : string
Return values
mixedgetPageTitle()
public
getPageTitle(
)
: string
Return values
stringaddResourcePath()
Adds a path to the list of paths to be searched for resources.
public
addResourcePath(
$path :
string
)
: mixed
Parameters
- $path : string
Tags
Return values
mixedaddCustomCss()
Adds a custom css file to be loaded.
public
addCustomCss(
$name :
string
)
: mixed
Parameters
- $name : string
Return values
mixedgetResourcePaths()
public
getResourcePaths(
)
: array
Return values
arraygetResourcesPath()
public
getResourcesPath(
)
: string
Tags
Return values
stringsetResourcesPath()
public
setResourcesPath(
$resourcesPath :
string
)
: mixed
Parameters
- $resourcesPath : string
Tags
Return values
mixedgetApplicationPaths()
Return the application paths.
public
getApplicationPaths(
)
: array
Return values
arraysetApplicationPaths()
Set the application paths.
public
setApplicationPaths(
$applicationPaths :
array
)
: mixed
Parameters
- $applicationPaths : array
Return values
mixedsetApplicationRootPath()
Set the application root path.
public
setApplicationRootPath(
$applicationRootPath :
string
)
: mixed
Parameters
- $applicationRootPath : string
Return values
mixedgetEditor()
Given a boolean if the editor link should act as an Ajax request. The editor must be a valid callable function/closure.
protected
getEditor(
$filePath :
string
, $line :
int
)
: array
Parameters
- $filePath : string
- $line : int
Return values
arraygetException()
protected
getException(
)
: Throwable
Return values
ThrowablegetInspector()
protected
getInspector(
)
: Inspector
Return values
InspectorgetResource()
Finds a resource, by its relative path, in all available search paths.
protected
getResource(
$resource :
string
)
: string
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
- $resource : string
Tags
Return values
stringmasked()
Checks all values within the given superGlobal array.
private
masked(
$superGlobal :
array
, $superGlobalName :
string
)
: 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'
Return values
array —$values without sensitive data
__construct()
Create a new ErrorRenderer object.
public
__construct(
$request :
ServerRequestInterface
, $response :
ResponseInterface
, $exception :
Throwable
[, $displayErrorDetails :
bool
= false ]
)
: mixed
Parameters
- $request : ServerRequestInterface
The most recent Request object
- $response : ResponseInterface
The most recent Response object
- $exception : Throwable
The caught Exception object
- $displayErrorDetails : bool = false
Return values
mixedrender()
public
abstract render(
)
: string
Return values
stringrenderWithBody()
public
renderWithBody(
)
: Body