54 \
Erebot\Interfaces\Event\Match $filter = null
56 $this->setCallback($callback);
57 $this->setFilter($filter);
67 $this->callback = $callback;
73 return $this->callback;
78 $this->filter = $filter;
91 if ($this->filter !== null) {
92 $matched = $this->filter->match($event);
95 $cb = $this->callback;
96 return ($matched ? $cb($this, $event) : null);
Interface for something that can be called.
$callback
Callable object to use when this handler is triggered.
handleEvent(\Erebot\Interfaces\Event\Base\Generic $event)
setFilter(\Erebot\Interfaces\Event\Match $filter=null)
setCallback(\Erebot\CallableInterface $callback)
Interface for event handlers.
An event handler which will call a callback function/method whenever a set of conditions are met...
$filter
Filtering object to decide whether the callback must be called or not.
__construct(\Erebot\CallableInterface $callback,\Erebot\Interfaces\Event\Match $filter=null)