PHP Класс Phergie\Irc\Bot\React\Bot

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Описание методов

getClient() публичный Метод

Returns the IRC client in use by the bot.
public getClient ( ) : Phergie\Irc\Client\React\ClientInterface
Результат Phergie\Irc\Client\React\ClientInterface

getConfig() публичный Метод

Returns the configuration in use by the bot.
public getConfig ( ) : array
Результат array Associative array keyed by setting name

getConnections() защищенный Метод

Extracts connections from configuration.
protected getConnections ( array $config ) : Phergie\Irc\ConnectionInterface[]
$config array Associative array keyed by setting name
Результат Phergie\Irc\ConnectionInterface[]

getConverter() публичный Метод

Returns the parser converter for event data in use by the bot.
public getConverter ( ) : Phergie\Irc\Event\ParserConverterInterface
Результат Phergie\Irc\Event\ParserConverterInterface

getDefaultPluginProcessors() защищенный Метод

Returns a list of default plugin processors used when none are set via configuration.
protected getDefaultPluginProcessors ( ) : Phergie\Irc\Bot\React\PluginProcessor\PluginProcessorInterface[]
Результат Phergie\Irc\Bot\React\PluginProcessor\PluginProcessorInterface[]

getEventQueueFactory() публичный Метод

Returns the event queue factory in use by the bot.
public getEventQueueFactory ( ) : Phergie\Irc\Bot\React\EventQueueFactoryInterface
Результат Phergie\Irc\Bot\React\EventQueueFactoryInterface

getEventSubtype() защищенный Метод

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
Результат string

getLogger() публичный Метод

Returns the logger in use by the bot.
public getLogger ( ) : Psr\Log\LoggerInterface
Результат Psr\Log\LoggerInterface

getParser() публичный Метод

Returns the parser for generated event data in use by the bot.
public getParser ( ) : Phergie\Irc\ParserInterface
Результат Phergie\Irc\ParserInterface

getPluginProcessors() защищенный Метод

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

getPlugins() защищенный Метод

Extracts plugins from configuration.
protected getPlugins ( array $config ) : Phergie\Irc\Bot\React\PluginInterface[]
$config array Associative array keyed by setting name
Результат Phergie\Irc\Bot\React\PluginInterface[]

processClientEvent() публичный Метод

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() публичный Метод

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() защищенный Метод

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

registerClientSubscribers() защищенный Метод

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() защищенный Метод

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

run() публичный Метод

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() публичный Метод

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

setConfig() публичный Метод

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

setConverter() публичный Метод

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() защищенный Метод

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

setEventQueueFactory() публичный Метод

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() публичный Метод

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

setParser() публичный Метод

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

validatePluginEvents() защищенный Метод

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

Описание свойств

$client защищенное свойство

IRC client in use by the bot
protected ClientInterface,Phergie\Irc\Client\React $client
Результат Phergie\Irc\Client\React\ClientInterface

$config защищенное свойство

Configuration in use by the bot
protected array $config
Результат array

$converter защищенное свойство

Converter for event data from the IRC client's underlying parser
protected ParserConverterInterface,Phergie\Irc\Event $converter
Результат Phergie\Irc\Event\ParserConverterInterface

$logger защищенное свойство

Logger in use by the bot, defaults to logger in use by the IRC client
protected LoggerInterface,Psr\Log $logger
Результат Psr\Log\LoggerInterface

$parser защищенное свойство

Parser for converting generated IRC commands into event objects
protected ParserInterface,Phergie\Irc $parser
Результат Phergie\Irc\ParserInterface

$queueFactory защищенное свойство

Event queue factory for creating connection-specific event queues
protected EventQueueFactoryInterface,Phergie\Irc\Bot\React $queueFactory
Результат Phergie\Irc\Bot\React\EventQueueFactoryInterface