Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\NumericHandler Class Reference

A class to handle numeric events. More...

+ Inheritance diagram for Erebot\NumericHandler:

Public Member Functions

 __construct (\Erebot\CallableInterface $callback, $numeric)
 
 getCallback ()
 
 getNumeric ()
 
 handleNumeric (\Erebot\Interfaces\Event\Numeric $numeric)
 
 setCallback (\Erebot\CallableInterface $callback)
 
 setNumeric ($numeric)
 

Protected Attributes

 $callback
 Method/function to call when this handler is triggered.
 
 $numeric
 Numeric code handled by this instance.
 

Detailed Description

A class to handle numeric events.

This class will call a given callback method/function whenever the bot receives a numeric event for the code this instance is meant to handle.

Definition at line 31 of file NumericHandler.php.

Constructor & Destructor Documentation

Erebot\NumericHandler::__construct ( \Erebot\CallableInterface  $callback,
  $numeric 
)

Constructs a numeric event handler.

Parameters
Erebot::CallableInterface$callbackA callback function/method which will be called whenever the bot receives a message with the given $numeric code.
int | Erebot::NumericReference$numericThe particular numeric code this numeric handler will react to, or a reference to it.

Definition at line 50 of file NumericHandler.php.

Member Function Documentation

Erebot\NumericHandler::getCallback ( )

Returns the callback function/method associated with this handler.

Return values
callbackThe callback for this handler.

Implements Erebot\Interfaces\NumericHandler.

Definition at line 73 of file NumericHandler.php.

Erebot\NumericHandler::getNumeric ( )

Returns the numeric code associated with this handler.

Return values
int|Erebot::NumericReferenceThe numeric code for this handler, or a reference to it.

Implements Erebot\Interfaces\NumericHandler.

Definition at line 62 of file NumericHandler.php.

Erebot\NumericHandler::handleNumeric ( \Erebot\Interfaces\Event\Numeric  $numeric)

Given a numeric message, this methods tries to handle it.

Parameters
Erebot::Interfaces::Event::Numeric$numericThe numeric message to try to handle.
Note
It is the implementation's duty to make any appropriate checks on the message and take any action depending on the result of those checks.

Implements Erebot\Interfaces\NumericHandler.

Definition at line 78 of file NumericHandler.php.

Erebot\NumericHandler::setCallback ( \Erebot\CallableInterface  $callback)

Sets the callback function/method associated with this handler.

Parameters
Erebot::CallableInterface$callbackNew callable associated with this handler.

Implements Erebot\Interfaces\NumericHandler.

Definition at line 67 of file NumericHandler.php.

Erebot\NumericHandler::setNumeric (   $numeric)

Sets the numeric code associated with this handler.

Parameters
int | Erebot::NumericReference$numericNew numeric code to assign to this handler, or a reference to it.

Implements Erebot\Interfaces\NumericHandler.

Definition at line 56 of file NumericHandler.php.


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