Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\Interfaces\EventHandler Interface Reference

Interface for event handlers. More...

+ Inheritance diagram for Erebot\Interfaces\EventHandler:

Public Member Functions

 getCallback ()
 
 getFilter ()
 
 handleEvent (\Erebot\Interfaces\Event\Base\Generic $event)
 
 setCallback (\Erebot\CallableInterface $callback)
 
 setFilter (\Erebot\Interfaces\Event\Match $filter=null)
 

Detailed Description

Interface for event handlers.

This interface provides the necessary methods to represent a structure capable of handling events from an IRC server.

Definition at line 30 of file EventHandler.php.

Member Function Documentation

Erebot\Interfaces\EventHandler::getCallback ( )

Returns a reference to the callback which was associated with this handler during construction.

Return values
callbackThe callback associated with this handler.

Implemented in Erebot\EventHandler.

Erebot\Interfaces\EventHandler::getFilter ( )

Returns the filter currently associated with this event handler.

Return values
Erebot::Interfaces::Event::MatchThe current filter associated with this event handler, or NULL if no filter has been set yet.

Implemented in Erebot\EventHandler.

Erebot\Interfaces\EventHandler::handleEvent ( \Erebot\Interfaces\Event\Base\Generic  $event)

Given an event, this method does its best to handler it.

Parameters
Erebot::Interfaces::Event::Base::Generic$eventAn event to try to handle.
Note
It is this method's responsability to make appropriate checks and act upon the result of those checks. It may for example check that the event matches the filters (on type, target and/or content) associated with the handler.

Implemented in Erebot\EventHandler.

Erebot\Interfaces\EventHandler::setCallback ( \Erebot\CallableInterface  $callback)

Sets the callback associated with this handler.

Parameters
Erebot::CallableInterface$callbackThis callable object will be called whenever an event is received that matches the criteria set by this event handler's filter.

Implemented in Erebot\EventHandler.

Erebot\Interfaces\EventHandler::setFilter ( \Erebot\Interfaces\Event\Match  $filter = null)

Sets the filter associated with this event handler.

Parameters
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.

Implemented in Erebot\EventHandler.


The documentation for this interface was generated from the following file: