-
Notifications
You must be signed in to change notification settings - Fork 0
API: The Handler Class
Adrian Testa-Avila edited this page Jan 28, 2017
·
9 revisions
Manages a registry of callback functions ("handlers") for errors, uncaught exceptions, and shutdown.
Registers this handler to invoke a callback, and then restores the previous handler(s).
- parameters:
- callable
$callback
The callback to invoke. - mixed
...$arguments
Argument(s) to pass to the callback.
- callable
- returns: mixed
The value returned from the callback.
Adds an error handler.
- parameters:
- callable
$handler
The handler to add. Must be suitable for use withset_error_handler. - int
$types
The error types the handler should be invoked for (a bitmask ofE_*constants). Defaults to "any error type."
- callable
- returns: at\exceptable\Handler
The Handler instance.
Adds a handler for uncaught exceptions.
- parameters:
- callable
$handler
The handler to add. Must be suitable for use withset_exception_handler. - int
$severity
The exception severities the handler should be invoked for (a bitmask ofExceptableseverity constants). Defaults to "any severity."
- callable
- returns: at\exceptable\Handler
The Handler instance.
Adds a shutdown handler.
Note, shutdown handlers should not be registered to handle fatal errors. If the shutdown is due to a fatal error, then then appropriate registered error handlers will be invoked; and should be handled there.
- parameters:
- callable
$handler
The handler to add. Must be suitable for use withregister_shutdown_function. - mixed
$arguments
Argument(s) to pass to the handler on shutdown.
- callable
- returns: at\exceptable\Handler
The Handler instance.
Starts the Handler ("makes its registered handlers "active").
- returns: at\exceptable\Handler
The Handler instance.
Sets error types which should be intercepted and thrown as ErrorExceptions.
- parameters:
- int
$types
The error types to be thrown. Defaults toE_ERROR|E_WARNING; use0to stop throwing.
- int
- returns: at\exceptable\Handler
The Handler instance.
Stops the Handler (makes its registered handlers "inactive").
- returns: at\exceptable\Handler
The Handler instance.