Erebot  latest
A modular IRC bot for PHP 7.0+
Erebot\EventHandler Class Reference

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

Detailed Description

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.

Constructor & Destructor Documentation

Erebot\EventHandler::__construct ( callable  $callback,
\Erebot\Interfaces\Event\Match  $filter = null 
)

Constructs an event handler.

Parameters
callback$callbackThe 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.


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