PHP Class Phergie\Irc\Bot\React\Bot

Afficher le fichier Open project: phergie/phergie-irc-bot-react Class Usage Examples

Protected Properties

Свойство Type Description
$client Phergie\Irc\Client\React\ClientInterface IRC client in use by the bot
$config array Configuration in use by the bot
$converter Phergie\Irc\Event\ParserConverterInterface Converter for event data from the IRC client's underlying parser
$logger Psr\Log\LoggerInterface Logger in use by the bot, defaults to logger in use by the IRC client
$parser Phergie\Irc\ParserInterface Parser for converting generated IRC commands into event objects
$queueFactory Phergie\Irc\Bot\React\EventQueueFactoryInterface Event queue factory for creating connection-specific event queues

Méthodes publiques

Méthode Description
getClient ( ) : Phergie\Irc\Client\React\ClientInterface Returns the IRC client in use by the bot.
getConfig ( ) : array Returns the configuration in use by the bot.
getConverter ( ) : Phergie\Irc\Event\ParserConverterInterface Returns the parser converter for event data in use by the bot.
getEventQueueFactory ( ) : Phergie\Irc\Bot\React\EventQueueFactoryInterface Returns the event queue factory in use by the bot.
getLogger ( ) : Psr\Log\LoggerInterface Returns the logger in use by the bot.
getParser ( ) : Phergie\Irc\ParserInterface Returns the parser for generated event data in use by the bot.
processClientEvent ( string $event, array $message, Phergie\Irc\ConnectionInterface $connection, Phergie\Irc\Client\React\WriteStream $write ) Callback to process client events. Not intended to be called from outside this class.
processOutgoingEvents ( Phergie\Irc\ConnectionInterface $connection, Phergie\Irc\Client\React\WriteStream $write ) Callback to process any queued outgoing events. Not intended to be called from outside thie class.
run ( boolean $autorun = true ) Initiates an event loop for the bot in which it will connect to servers and monitor those connections for events to forward to plugins.
setClient ( Phergie\Irc\Client\React\ClientInterface $client ) Sets the IRC client for the bot to use.
setConfig ( array $config ) Sets the configuration to be used by the bot in its operations.
setConverter ( Phergie\Irc\Event\ParserConverterInterface $converter ) Sets the parser converter for event data in use by the bot.
setEventQueueFactory ( Phergie\Irc\Bot\React\EventQueueFactoryInterface $queueFactory ) Sets the event queue factory for the bot to use.
setLogger ( Psr\Log\LoggerInterface $logger ) Sets the logger in use by the bot.
setParser ( Phergie\Irc\ParserInterface $parser ) Sets the parser for generated event data in use by the bot.

Méthodes protégées

Méthode Description
getConnections ( array $config ) : Phergie\Irc\ConnectionInterface[] Extracts connections from configuration.
getDefaultPluginProcessors ( ) : Phergie\Irc\Bot\React\PluginProcessor\PluginProcessorInterface[] Returns a list of default plugin processors used when none are set via configuration.
getEventSubtype ( Phergie\Irc\Event\EventInterface $event ) : string Returns an event subtype corresponding to a given event object, used to generate event names when emitting events.
getPluginProcessors ( array $config ) Returns a list of processors for plugins.
getPlugins ( array $config ) : Phergie\Irc\Bot\React\PluginInterface[] Extracts plugins from configuration.
processPlugins ( array $plugins, array $processors, SplObjectStorage $processedPlugins = null ) Processes a list of plugins for use.
registerClientSubscribers ( Phergie\Irc\Client\React\ClientInterface $client ) Configures the client to emit events for specific types of messages.
registerPluginSubscribers ( array $plugins ) Registers event callbacks from plugins.
setDependencyOverrides ( array $config ) Sets dependencies from configuration.
validatePluginEvents ( Phergie\Irc\Bot\React\PluginInterface $plugin ) Validates a plugin's event callbacks.

Method Details

getClient() public méthode

Returns the IRC client in use by the bot.
public getClient ( ) : Phergie\Irc\Client\React\ClientInterface
Résultat Phergie\Irc\Client\React\ClientInterface

getConfig() public méthode

Returns the configuration in use by the bot.
public getConfig ( ) : array
Résultat array Associative array keyed by setting name

getConnections() protected méthode

Extracts connections from configuration.
protected getConnections ( array $config ) : Phergie\Irc\ConnectionInterface[]
$config array Associative array keyed by setting name
Résultat Phergie\Irc\ConnectionInterface[]

getConverter() public méthode

Returns the parser converter for event data in use by the bot.
public getConverter ( ) : Phergie\Irc\Event\ParserConverterInterface
Résultat Phergie\Irc\Event\ParserConverterInterface

getDefaultPluginProcessors() protected méthode

Returns a list of default plugin processors used when none are set via configuration.
protected getDefaultPluginProcessors ( ) : Phergie\Irc\Bot\React\PluginProcessor\PluginProcessorInterface[]
Résultat Phergie\Irc\Bot\React\PluginProcessor\PluginProcessorInterface[]

getEventQueueFactory() public méthode

Returns the event queue factory in use by the bot.
public getEventQueueFactory ( ) : Phergie\Irc\Bot\React\EventQueueFactoryInterface
Résultat Phergie\Irc\Bot\React\EventQueueFactoryInterface

getEventSubtype() protected méthode

Returns an event subtype corresponding to a given event object, used to generate event names when emitting events.
protected getEventSubtype ( Phergie\Irc\Event\EventInterface $event ) : string
$event Phergie\Irc\Event\EventInterface
Résultat string

getLogger() public méthode

Returns the logger in use by the bot.
public getLogger ( ) : Psr\Log\LoggerInterface
Résultat Psr\Log\LoggerInterface

getParser() public méthode

Returns the parser for generated event data in use by the bot.
public getParser ( ) : Phergie\Irc\ParserInterface
Résultat Phergie\Irc\ParserInterface

getPluginProcessors() protected méthode

Returns a list of processors for plugins.
protected getPluginProcessors ( array $config )
$config array Associative array keyed by setting name

getPlugins() protected méthode

Extracts plugins from configuration.
protected getPlugins ( array $config ) : Phergie\Irc\Bot\React\PluginInterface[]
$config array Associative array keyed by setting name
Résultat Phergie\Irc\Bot\React\PluginInterface[]

processClientEvent() public méthode

Callback to process client events. Not intended to be called from outside this class.
public processClientEvent ( string $event, array $message, Phergie\Irc\ConnectionInterface $connection, Phergie\Irc\Client\React\WriteStream $write )
$event string Received client event
$message array Parsed message
$connection Phergie\Irc\ConnectionInterface Connection on which the event occurred
$write Phergie\Irc\Client\React\WriteStream Stream used to send commands to the server

processOutgoingEvents() public méthode

Callback to process any queued outgoing events. Not intended to be called from outside thie class.
public processOutgoingEvents ( Phergie\Irc\ConnectionInterface $connection, Phergie\Irc\Client\React\WriteStream $write )
$connection Phergie\Irc\ConnectionInterface Connection on which the event occurred
$write Phergie\Irc\Client\React\WriteStream Stream used to send commands to the server

processPlugins() protected méthode

Processes a list of plugins for use.
protected processPlugins ( array $plugins, array $processors, SplObjectStorage $processedPlugins = null )
$plugins array
$processors array
$processedPlugins SplObjectStorage

registerClientSubscribers() protected méthode

Configures the client to emit events for specific types of messages.
protected registerClientSubscribers ( Phergie\Irc\Client\React\ClientInterface $client )
$client Phergie\Irc\Client\React\ClientInterface Client for which to configure events

registerPluginSubscribers() protected méthode

Registers event callbacks from plugins.
protected registerPluginSubscribers ( array $plugins )
$plugins array Plugins from which to get callbacks

run() public méthode

Initiates an event loop for the bot in which it will connect to servers and monitor those connections for events to forward to plugins.
public run ( boolean $autorun = true )
$autorun boolean

setClient() public méthode

Sets the IRC client for the bot to use.
public setClient ( Phergie\Irc\Client\React\ClientInterface $client )
$client Phergie\Irc\Client\React\ClientInterface

setConfig() public méthode

See config.sample.php for an example configuration file.
public setConfig ( array $config )
$config array Associative array keyed by setting name

setConverter() public méthode

Sets the parser converter for event data in use by the bot.
public setConverter ( Phergie\Irc\Event\ParserConverterInterface $converter )
$converter Phergie\Irc\Event\ParserConverterInterface

setDependencyOverrides() protected méthode

Sets dependencies from configuration.
protected setDependencyOverrides ( array $config )
$config array

setEventQueueFactory() public méthode

Sets the event queue factory for the bot to use.
public setEventQueueFactory ( Phergie\Irc\Bot\React\EventQueueFactoryInterface $queueFactory )
$queueFactory Phergie\Irc\Bot\React\EventQueueFactoryInterface

setLogger() public méthode

Sets the logger in use by the bot.
public setLogger ( Psr\Log\LoggerInterface $logger )
$logger Psr\Log\LoggerInterface

setParser() public méthode

Sets the parser for generated event data in use by the bot.
public setParser ( Phergie\Irc\ParserInterface $parser )
$parser Phergie\Irc\ParserInterface

validatePluginEvents() protected méthode

Validates a plugin's event callbacks.
protected validatePluginEvents ( Phergie\Irc\Bot\React\PluginInterface $plugin )
$plugin Phergie\Irc\Bot\React\PluginInterface

Property Details

$client protected_oe property

IRC client in use by the bot
protected ClientInterface,Phergie\Irc\Client\React $client
Résultat Phergie\Irc\Client\React\ClientInterface

$config protected_oe property

Configuration in use by the bot
protected array $config
Résultat array

$converter protected_oe property

Converter for event data from the IRC client's underlying parser
protected ParserConverterInterface,Phergie\Irc\Event $converter
Résultat Phergie\Irc\Event\ParserConverterInterface

$logger protected_oe property

Logger in use by the bot, defaults to logger in use by the IRC client
protected LoggerInterface,Psr\Log $logger
Résultat Psr\Log\LoggerInterface

$parser protected_oe property

Parser for converting generated IRC commands into event objects
protected ParserInterface,Phergie\Irc $parser
Résultat Phergie\Irc\ParserInterface

$queueFactory protected_oe property

Event queue factory for creating connection-specific event queues
protected EventQueueFactoryInterface,Phergie\Irc\Bot\React $queueFactory
Résultat Phergie\Irc\Bot\React\EventQueueFactoryInterface