PHP Class Whoops\Handler\PrettyPageHandler

Inheritance: extends Whoops\Handler\Handler
显示文件 Open project: filp/whoops Class Usage Examples

Protected Properties

Property Type Description
$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.
$editors array A list of known editor strings

Public Methods

Method Description
__construct ( ) Constructor.
addCustomCss ( string $name ) : void Adds a custom css file to be loaded.
addDataTable ( string $label, array $data ) Adds an entry to the list of tables displayed in the template.
addDataTableCallback ( string $label, callable $callback ) Lazily adds an entry to the list of tables displayed in the table.
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.
addResourcePath ( string $path ) : void Adds a path to the list of paths to be searched for resources.
getApplicationPaths ( ) : array Return the application paths.
getDataTables ( string | null $label = null ) : array[] | callable Returns all the extra data tables registered with this handler.
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
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.
getPageTitle ( ) : string
getResourcePaths ( ) : array
getResourcesPath ( ) : string
handle ( ) : integer | null
handleUnconditionally ( boolean | null $value = null ) : boolean | null Allows to disable all attempts to dynamically decide whether to handle or return prematurely.
setApplicationPaths ( array $applicationPaths ) Set the application paths.
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.
setPageTitle ( string $title ) : void
setResourcesPath ( string $resourcesPath ) : void

Protected Methods

Method Description
getEditor ( string $filePath, integer $line ) : mixed Given a boolean if the editor link should act as an Ajax request. The editor must be a valid callable function/closure
getResource ( string $resource ) : string Finds a resource, by its relative path, in all available search paths.

Method Details

__construct() public method

Constructor.
public __construct ( )

addCustomCss() public method

Adds a custom css file to be loaded.
public addCustomCss ( string $name ) : void
$name string
return void

addDataTable() public method

The expected data is a simple associative array. Any nested arrays will be flattened with print_r
public addDataTable ( string $label, array $data )
$label string
$data array

addDataTableCallback() public method

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.
public addDataTableCallback ( string $label, callable $callback )
$label string
$callback callable Callable returning an associative array

addEditor() public method

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 ( string $identifier, string $resolver )
$identifier string
$resolver string

addResourcePath() public method

Adds a path to the list of paths to be searched for resources.
public addResourcePath ( string $path ) : void
$path string
return void

getApplicationPaths() public method

Return the application paths.
public getApplicationPaths ( ) : array
return array

getDataTables() public method

Optionally accepts a 'label' parameter, to only return the data table under that label.
public getDataTables ( string | null $label = null ) : array[] | callable
$label string | null
return array[] | callable

getEditor() protected method

Given a boolean if the editor link should act as an Ajax request. The editor must be a valid callable function/closure
protected getEditor ( string $filePath, integer $line ) : mixed
$filePath string
$line integer
return mixed

getEditorAjax() public method

Given a boolean if the editor link should act as an Ajax request. The editor must be a valid callable function/closure
public getEditorAjax ( string $filePath, integer $line ) : boolean
$filePath string
$line integer
return boolean

getEditorHref() public method

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 ( string $filePath, integer $line ) : string | boolean
$filePath string
$line integer
return string | boolean

getPageTitle() public method

public getPageTitle ( ) : string
return string

getResource() protected method

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.
protected getResource ( string $resource ) : string
$resource string
return string

getResourcePaths() public method

public getResourcePaths ( ) : array
return array

getResourcesPath() public method

Deprecation:
public getResourcesPath ( ) : string
return string

handle() public method

public handle ( ) : integer | null
return integer | null

handleUnconditionally() public method

Set this to ensure that the handler will perform no matter what.
public handleUnconditionally ( boolean | null $value = null ) : boolean | null
$value boolean | null
return boolean | null

setApplicationPaths() public method

Set the application paths.
public setApplicationPaths ( array $applicationPaths )
$applicationPaths array

setEditor() public method

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 ( string | callable $editor )
$editor string | callable

setPageTitle() public method

public setPageTitle ( string $title ) : void
$title string
return void

setResourcesPath() public method

Deprecation:
public setResourcesPath ( string $resourcesPath ) : void
$resourcesPath string
return void

Property Details

$editor protected_oe property

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
return mixed

$editors protected_oe property

A list of known editor strings
protected array $editors
return array