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

Interface for a class that can be used to parse incoming messages from an IRC server and create events as necessary. More...

+ Inheritance diagram for Erebot\Interfaces\IrcParser:

Public Member Functions

 getEventClass ($iface)
 
 getEventClasses ()
 
 makeEvent ($iface)
 
 parseLine ($msg)
 
 setEventClass ($iface, $cls)
 
 setEventClasses ($events)
 

Detailed Description

Interface for a class that can be used to parse incoming messages from an IRC server and create events as necessary.

Definition at line 29 of file IrcParser.php.

Member Function Documentation

Erebot\Interfaces\IrcParser::getEventClass (   $iface)

Returns the name of the class used to create events for a certain interface.

Parameters
string$ifaceThe name of the interface describing the type of event.
Return values
stringName of the class to use to create events for the given interface.
nullReturned when no class has been registered yet to create events for the given interface.
Note
The name of the interface is case-insensitive.

Implemented in Erebot\IrcParser.

Erebot\Interfaces\IrcParser::getEventClasses ( )

Returns the mapping of interface names to their factory.

Return values
arrayMapping of event interfaces names to their factory.

Implemented in Erebot\IrcParser.

Erebot\Interfaces\IrcParser::makeEvent (   $iface)

Factory to create an event matching the given interface, passing any additional parameters given to this method to the constructor for that event.

Parameters
string$ifaceName of the interface describing the type of event to create.
Return values
Erebot::Interfaces::Event::Base_GenericThe event that was produced. This will be an instance implementing the given interface and a subclass of Erebot::Interfaces::Event::Base::Generic.
Note
You may pass additional parameters to this method. They will be passed as is to the event's constructor.

Implemented in Erebot\IrcParser.

Erebot\Interfaces\IrcParser::parseLine (   $msg)

Parses a single message from an IRC server.

Parameters
string$msgA single IRC message to parse, with the trailing "\r\n" sequence already removed.
Note
Events are dispatched as necessary by this method.

Implemented in Erebot\IrcParser.

Erebot\Interfaces\IrcParser::setEventClass (   $iface,
  $cls 
)

Sets the class to use when creating events for a certain interface.

Parameters
string$ifaceInterface to associate the class with.
string$clsClass to use when creating events for that interface.
Exceptions
Erebot::InvalidValueExceptionThe given class does not implement the given interface and therefore cannot be used as a factory.
Note
The name of the interface is case-insensitive.

Implemented in Erebot\IrcParser.

Erebot\Interfaces\IrcParser::setEventClasses (   $events)

Sets the mapping from event interfaces names to their factory.

Parameters
array$eventsMapping from interfaces names to their factory.

Implemented in Erebot\IrcParser.


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