Definition at line 17 of file Run.php.
◆ allowQuit()
Whoops\Run::allowQuit |
( |
|
$exit = null | ) |
|
Should Whoops allow Handlers to force the script to quit?
- Parameters
-
- Returns
- bool
Definition at line 148 of file Run.php.
150 if (func_num_args() == 0) {
allowQuit($exit=null)
Should Whoops allow Handlers to force the script to quit?
◆ clearHandlers()
Whoops\Run::clearHandlers |
( |
| ) |
|
Clears all handlers in the handlerStack, including the default PrettyPage handler.
- Returns
- Run
Definition at line 88 of file Run.php.
90 $this->handlerStack = array();
◆ getHandlers()
Whoops\Run::getHandlers |
( |
| ) |
|
Returns an array with all handlers, in the order they were added to the stack.
- Returns
- array
Definition at line 78 of file Run.php.
◆ getInspector()
Whoops\Run::getInspector |
( |
Exception |
$exception | ) |
|
|
protected |
- Parameters
-
- Returns
- Inspector
Definition at line 98 of file Run.php.
100 return new Inspector($exception);
◆ handleError()
Whoops\Run::handleError |
( |
|
$level, |
|
|
|
$message, |
|
|
|
$file = null , |
|
|
|
$line = null |
|
) |
| |
Converts generic PHP errors to instances, before passing them off to be handled.
This method MUST be compatible with set_error_handler.
- Parameters
-
int | $level | |
string | $message | |
string | $file | |
int | $line | |
- Returns
- bool
- Exceptions
-
Definition at line 309 of file Run.php.
References $file.
311 if ($level & error_reporting()) {
312 foreach ($this->silencedPatterns as $entry) {
313 $pathMatches = (bool) preg_match($entry[
"pattern"],
$file);
314 $levelMatches = $level & $entry[
"levels"];
315 if ($pathMatches && $levelMatches) {
321 $exception =
new ErrorException($message, $level, 0,
$file, $line);
322 if ($this->canThrowExceptions) {
handleException(Exception $exception)
Handles an exception, ultimately generating a Whoops error page.
◆ handleException()
Whoops\Run::handleException |
( |
Exception |
$exception | ) |
|
Handles an exception, ultimately generating a Whoops error page.
- Parameters
-
- Returns
- string Output generated by handlers
Definition at line 233 of file Run.php.
References exit.
245 $handlerResponse = null;
247 foreach (array_reverse($this->handlerStack) as $handler) {
248 $handler->setRun($this);
249 $handler->setInspector($inspector);
250 $handler->setException($exception);
256 $handlerResponse = $handler->handle($exception);
269 $output = ob_get_clean();
279 while (ob_get_level() > 0) {
writeToOutput($send=null)
Should Whoops push output directly to the client? If this is false, output will be returned by handle...
writeToOutputNow($output)
Echo something to the browser.
getInspector(Exception $exception)
allowQuit($exit=null)
Should Whoops allow Handlers to force the script to quit?
◆ handleShutdown()
Whoops\Run::handleShutdown |
( |
| ) |
|
Special case to deal with Fatal errors and the like.
Definition at line 339 of file Run.php.
344 $this->canThrowExceptions =
false;
346 $error = error_get_last();
handleError($level, $message, $file=null, $line=null)
Converts generic PHP errors to instances, before passing them off to be handled. ...
static isLevelFatal($level)
◆ isLevelFatal()
static Whoops\Run::isLevelFatal |
( |
|
$level | ) |
|
|
staticprivate |
◆ popHandler()
Whoops\Run::popHandler |
( |
| ) |
|
Removes the last handler in the stack and returns it.
Returns null if there"s nothing else to pop.
- Returns
- null|HandlerInterface
Definition at line 68 of file Run.php.
70 return array_pop($this->handlerStack);
◆ pushHandler()
Whoops\Run::pushHandler |
( |
|
$handler | ) |
|
Pushes a handler to the end of the stack.
- Exceptions
-
InvalidArgumentException | If argument is not callable or instance of HandlerInterface |
- Parameters
-
Callable | HandlerInterface | $handler | |
- Returns
- Run
Definition at line 46 of file Run.php.
48 if (is_callable($handler)) {
49 $handler =
new CallbackHandler($handler);
52 if (!$handler instanceof HandlerInterface) {
54 "Argument to " . __METHOD__ .
" must be a callable, or instance of" 55 .
"Whoops\\Handler\\HandlerInterface" 59 $this->handlerStack[] = $handler;
◆ register()
Registers this instance as an error handler.
- Returns
- Run
Definition at line 107 of file Run.php.
109 if (!$this->isRegistered) {
112 class_exists(
"\\Whoops\\Exception\\ErrorException");
113 class_exists(
"\\Whoops\\Exception\\FrameCollection");
114 class_exists(
"\\Whoops\\Exception\\Frame");
115 class_exists(
"\\Whoops\\Exception\\Inspector");
117 set_error_handler(array($this, self::ERROR_HANDLER));
118 set_exception_handler(array($this, self::EXCEPTION_HANDLER));
119 register_shutdown_function(array($this, self::SHUTDOWN_HANDLER));
121 $this->isRegistered =
true;
◆ sendHttpCode()
Whoops\Run::sendHttpCode |
( |
|
$code = null | ) |
|
Definition at line 188 of file Run.php.
References $code.
190 if (func_num_args() == 0) {
198 if (
$code ===
true) {
204 "Invalid status code '$code', must be 4xx or 5xx"
◆ silenceErrorsInPaths()
Whoops\Run::silenceErrorsInPaths |
( |
|
$patterns, |
|
|
|
$levels = 10240 |
|
) |
| |
Silence particular errors in particular files.
- Parameters
-
array | string | $patterns | List or a single regex pattern to match |
int | $levels | Defaults to E_STRICT | E_DEPRECATED |
- Returns
Definition at line 163 of file Run.php.
165 $this->silencedPatterns = array_merge(
166 $this->silencedPatterns,
168 function ($pattern) use ($levels) {
170 "pattern" => $pattern,
◆ unregister()
Whoops\Run::unregister |
( |
| ) |
|
Unregisters all handlers registered by this Whoops instance.
- Returns
- Run
Definition at line 131 of file Run.php.
133 if ($this->isRegistered) {
134 restore_exception_handler();
135 restore_error_handler();
137 $this->isRegistered =
false;
◆ writeToOutput()
Whoops\Run::writeToOutput |
( |
|
$send = null | ) |
|
Should Whoops push output directly to the client? If this is false, output will be returned by handleException.
- Parameters
-
- Returns
- bool
Definition at line 217 of file Run.php.
219 if (func_num_args() == 0) {
223 return $this->sendOutput = (bool) $send;
◆ writeToOutputNow()
Whoops\Run::writeToOutputNow |
( |
|
$output | ) |
|
|
private |
Echo something to the browser.
- Parameters
-
- Returns
- $this
Definition at line 370 of file Run.php.
375 if (function_exists(
'http_response_code')) {
376 http_response_code($httpCode);
387 header(
'X-Ignore-This: 1',
true, $httpCode);
Whoops - php errors for cool kids.
◆ $allowQuit
Whoops\Run::$allowQuit = true |
|
protected |
◆ $canThrowExceptions
Whoops\Run::$canThrowExceptions = true |
|
private |
◆ $handlerStack
Whoops\Run::$handlerStack = array() |
|
protected |
◆ $isRegistered
Whoops\Run::$isRegistered |
|
protected |
◆ $sendHttpCode
Whoops\Run::$sendHttpCode = 500 |
|
protected |
◆ $sendOutput
Whoops\Run::$sendOutput = true |
|
protected |
◆ $silencedPatterns
Whoops\Run::$silencedPatterns = array() |
|
protected |
◆ ERROR_HANDLER
const Whoops\Run::ERROR_HANDLER = "handleError" |
◆ EXCEPTION_HANDLER
const Whoops\Run::EXCEPTION_HANDLER = "handleException" |
◆ SHUTDOWN_HANDLER
const Whoops\Run::SHUTDOWN_HANDLER = "handleShutdown" |
The documentation for this class was generated from the following file:
- Services/Exceptions/lib/Whoops/Run.php