|
Erebot
latest
A modular IRC bot for PHP 5.3+
|
An event handler which will call a callback function/method whenever a set of conditions are met. More...
Inheritance diagram for Erebot\EventHandler:Public Member Functions | |
| __construct (\Erebot\CallableInterface $callback,\Erebot\Interfaces\Event\Match $filter=null) | |
| __destruct () | |
| Destructor. | |
| getCallback () | |
| getFilter () | |
| handleEvent (\Erebot\Interfaces\Event\Base\Generic $event) | |
| setCallback (\Erebot\CallableInterface $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 | ( | \Erebot\CallableInterface | $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.
| Erebot\EventHandler::getCallback | ( | ) |
Returns a reference to the callback which was associated with this handler during construction.
| callback | The callback associated with this handler. |
Implements Erebot\Interfaces\EventHandler.
Definition at line 71 of file EventHandler.php.
| Erebot\EventHandler::getFilter | ( | ) |
Returns the filter currently associated with this event handler.
| Erebot::Interfaces::Event::Match | The current filter associated with this event handler, or NULL if no filter has been set yet. |
Implements Erebot\Interfaces\EventHandler.
Definition at line 82 of file EventHandler.php.
| Erebot\EventHandler::handleEvent | ( | \Erebot\Interfaces\Event\Base\Generic | $event | ) |
Given an event, this method does its best to handler it.
| Erebot::Interfaces::Event::Base::Generic | $event | An event to try to handle. |
Implements Erebot\Interfaces\EventHandler.
Definition at line 87 of file EventHandler.php.
| Erebot\EventHandler::setCallback | ( | \Erebot\CallableInterface | $callback | ) |
Sets the callback associated with this handler.
| Erebot::CallableInterface | $callback | This callable object will be called whenever an event is received that matches the criteria set by this event handler's filter. |
Implements Erebot\Interfaces\EventHandler.
Definition at line 65 of file EventHandler.php.
| Erebot\EventHandler::setFilter | ( | \Erebot\Interfaces\Event\Match | $filter = null | ) |
Sets the filter associated with this event handler.
| Erebot::Interfaces::Event::Match | $filter | (optional) The new filter associated with this event handler. Its criterion must sucessfully match the contents of an event for that event to trigger this event handler's callback. |
Implements Erebot\Interfaces\EventHandler.
Definition at line 76 of file EventHandler.php.