Erebot
latest
A modular IRC bot for PHP 7.0+
|
An event handler which will call a callback function/method whenever a set of conditions are met. More...
Public Member Functions | |
__construct (callable $callback,\Erebot\Interfaces\Event\Match $filter=null) | |
__destruct () | |
Destructor. | |
getCallback () | |
getFilter () | |
handleEvent (\Erebot\Interfaces\Event\Base\Generic $event) | |
setCallback (callable $callback) | |
setFilter (\Erebot\Interfaces\Event\Match $filter=null) | |
Protected Attributes | |
$callback | |
Callable object to use when this handler is triggered. | |
$filter | |
Filtering object to decide whether the callback must be called or not. | |
An event handler which will call a callback function/method whenever a set of conditions are met.
Such conditions may be related to the event being of a certain type, being addressed to a certain target and/or having a certain content.
Definition at line 31 of file EventHandler.php.
Erebot\EventHandler::__construct | ( | callable | $callback, |
\Erebot\Interfaces\Event\Match | $filter = null |
||
) |
Constructs an event handler.
callback | $callback | The callback function/method which will be called when an event is received which meets the $constraints, is part of valid $targets and passed the $filters successfully. |
null | Erebot::Interfaces::Event::Match | $filter | (optional) A filter which must be matched for the callback associated with this handler to be called. |
Definition at line 52 of file EventHandler.php.