mirror of
https://github.com/filp/whoops.git
synced 2026-09-02 21:47:17 +00:00
PrettyPageHandler: handleUnconditionally, close #115
This commit is contained in:
@@ -32,6 +32,11 @@ class PrettyPageHandler extends Handler
|
||||
*/
|
||||
private $extraTables = array();
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
private $handleUnconditionally = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@@ -81,10 +86,12 @@ class PrettyPageHandler extends Handler
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
// Check conditions for outputting HTML:
|
||||
// @todo: make this more robust
|
||||
if(php_sapi_name() === 'cli' && !isset($_ENV['whoops-test'])) {
|
||||
return Handler::DONE;
|
||||
if (!$this->handleUnconditionally()) {
|
||||
// Check conditions for outputting HTML:
|
||||
// @todo: make this more robust
|
||||
if(php_sapi_name() === 'cli' && !isset($_ENV['whoops-test'])) {
|
||||
return Handler::DONE;
|
||||
}
|
||||
}
|
||||
|
||||
// @todo Make this more dynamic ~~ *
|
||||
@@ -201,6 +208,23 @@ class PrettyPageHandler extends Handler
|
||||
return $this->extraTables;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @param bool|null $value
|
||||
* @return bool|null
|
||||
*/
|
||||
public function handleUnconditionally($value = null)
|
||||
{
|
||||
if(func_num_args() == 0) {
|
||||
return $this->handleUnconditionally;
|
||||
}
|
||||
|
||||
$this->handleUnconditionally = (bool) $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds an editor resolver, identified by a string
|
||||
* name, and that may be a string path, or a callable
|
||||
|
||||
Reference in New Issue
Block a user