Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\Event\Match\Source Class Reference

A filter which matches when the source of the event equals some predefined value. More...

+ Inheritance diagram for Erebot\Event\Match\Source:

Public Member Functions

 __construct ($source)
 
 getSource ()
 
 match (\Erebot\Interfaces\Event\Base\Generic $event)
 
 setSource ($source)
 

Protected Attributes

 $source
 Source to use in the comparison, as a string.
 

Detailed Description

A filter which matches when the source of the event equals some predefined value.

Note
Events that have no "source" never match.

Definition at line 31 of file Source.php.

Constructor & Destructor Documentation

Erebot\Event\Match\Source::__construct (   $source)

Creates a new instance of the filter.

Parameters
$sourcestring|object Source to match incoming events against.
Exceptions
Erebot::InvalidValueExceptionThe given source is invalid.

Definition at line 45 of file Source.php.

References Erebot\Event\Match\Source\$source, and Erebot\Event\Match\Source\setSource().

Member Function Documentation

Erebot\Event\Match\Source::getSource ( )

Returns the source associated with this filter.

Return values
stringSource associated with this filter.

Definition at line 56 of file Source.php.

References Erebot\Event\Match\Source\$source.

Erebot\Event\Match\Source::match ( \Erebot\Interfaces\Event\Base\Generic  $event)

Decides whether the given event passes the filter or not.

Parameters
$eventAn event to try to match to the criterion expressed by this filter.
Return values
booltrue if the event matches the criterion, false otherwise.

Implements Erebot\Interfaces\Event\Match.

Definition at line 79 of file Source.php.

Erebot\Event\Match\Source::setSource (   $source)

Sets the source used in comparisons.

Parameters
$sourcestring|object Source to match incoming events against.
Exceptions
Erebot::InvalidValueExceptionThe given source is invalid.

Definition at line 70 of file Source.php.

References Erebot\Event\Match\Source\$source, and Erebot\Utils\stringifiable().

Referenced by Erebot\Event\Match\Source\__construct().


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