-
-
Notifications
You must be signed in to change notification settings - Fork 604
API Documentation
filp edited this page Apr 11, 2013
·
19 revisions
The Run
class models an instance of an execution, and integrates the methods to control whoops' execution in that context, and control the handlers stack.
string Run::EXCEPTION_HANDLER // (name for exception handler method)
string Run::ERROR_HANDLER // (name for error handler method)
string Run::SHUTDOWN_HANDLER // (name for shutdown handler method)
// Pushes a new handler to the stack of handlers
Run::pushHandler( Whoops\HandlerInterface $handler )
#=> Whoops\Run
// Pops and returns the last handler from the stack
Run::popHandler()
#=> Whoops\HandlerInterface
// Returns all handlers in the stack
Run::getHandlers()
#=> Whoops\HandlerInterface[]
// Returns a Whoops\Inspector instance for a given Exception
Run::getInspector( Exception $exception )
#=> Whoops\Exception\Inspector
// Registers this Whoops\Run instance as an error/exception/shutdown
// handler with PHP
Run::register()
#=> Whoops\Run
// I'll let you guess this one
Run::unregister()
#=> Whoops\Run
// If true, allows Whoops to terminate script execution (default: true)
Run::allowQuit( $allowQuit = null )
#=> bool
// ** HANDLERS **
// These are semi-internal methods that receive input from
// PHP directly. If you know what you're doing, you can
// also call them directly
// Handles an exception with the current stack
Run::handleException( Exception $exception )
#=> null
// Handles an error with the current stack. Errors are
// converted into SPL ErrorException instances
Run::handleError( int $level, string $message, string $file = null, int $line = null)
#=> null
// Hooked as a shutdown handler, captures fatal errors and handles them
// through the current stack:
Run::handleShutdown()
#=> null
This abstract class contains the base methods for concrete handler implementations. Custom handlers can extend it, or implement the Whoops\Handler\HandlerInterface
interface.
int Handler::DONE // If returned from HandlerInterface::handle, does absolutely nothing.
int Handler::LAST_HANDLER // ...tells whoops to not execute any more handlers after this one.
int Handler::QUIT // ...tells whoops to quit script execution immediately.
// Custom handlers should expose this method, which will be called once an
// exception needs to be handled. The Handler::* constants can be used to
// signal the underlying logic as to what to do next.
HandlerInterface::handle()
#=> null | int
// Sets the Run instance for this handler
HandlerInterface::setRun( Whoops\Run $run)
#=> null
// Sets the Inspector instance for this handler
HandlerInterface::setInspector( Whoops\Exception\Inspector $inspector)
#=> null
// Sets the Exception for this handler to handle
HandlerInterface::setException( Exception $exception )
#=> null
** GETTERS **
Handler::getRun()
#=> Whoops\Run
Handler::getInspector()
#=> Whoops\Exception\Inspector
Handler::getException()
#=> Exception