Property | Type | Description | |
---|---|---|---|
$activeConnections | SplObjectStorage | Contains all connection instances associated with an active socket stream | |
$dnsServer | string | ||
$logger | Psr\Log\LoggerInterface | Logging stream | |
$loop | React\EventLoop\LoopInterface | Event loop | |
$resolver | React\Dns\Resolver\Resolver | ||
$secureConnector | React\SocketClient\SecureConnector | Connector used to establish SSL connections | |
$tickInterval | float | Interval in seconds between irc.tick events |
Method | Description | |
---|---|---|
addConnection ( Phergie\Irc\ConnectionInterface $connection ) | Initializes an IRC connection. | |
addPeriodicTimer ( numeric $interval, callable $callback ) : React\Event\Timer\TimerInterface | Adds a recurring callback to execute on a specified interval. Proxies to addPeriodTimer() implementation of the event loop implementation returned by getLoop(). | |
addTimer ( numeric $interval, callable $callback ) : React\Event\Timer\TimerInterface | Adds a one-time callback to execute after a specified amount of time has passed. Proxies to addTimer() implementation of the event loop implementation returned by getLoop(). | |
cancelTimer ( React\EventLoop\Timer\TimerInterface $timer ) | Cancels a specified timer created using addTimer() or addPeriodicTimer(). Proxies to the cancelTimer() implementation of the event loop implementation returned by getLoop(). | |
getActiveConnections ( ) : Phergie\Irc\ConnectionInterface[] | Gets an array of all connections associated with an active socket stream. | |
getDnsServer ( ) : string | Returns the configured DNS server | |
getLogger ( ) : Psr\Log\LoggerInterface | Returns a stream instance for logging data on the socket connection. | |
getLoop ( ) : React\EventLoop\LoopInterface | Returns the event loop dependency, initializing it if needed. | |
getResolver ( ) : React\Dns\Resolver\Resolver | Get the DNS Resolver, if one isn't set in instance will be created. | |
getTickInterval ( ) : float | Returns the interval in seconds between irc.tick events. | |
isTimerActive ( React\EventLoop\Timer\TimerInterface $timer ) : boolean | Checks if a timer created using addTimer() or addPeriodicTimer() is active. Proxies to the isTimerActive() implementation of the event loop implementation returned by getLoop(). | |
run ( Phergie\Irc\ConnectionInterface | Phergie\Irc\ConnectionInterface[] $connections, boolean $autorun = true ) | Executes the event loop, which continues running until no active connections remain. | |
setDnsServer ( string $dnsServer = '8.8.8.8' ) | Set the DNS server to use when looking up IP's | |
setLogger ( Psr\Log\LoggerInterface $logger ) | Sets a logger for logging data on the socket connection. | |
setLoop ( React\EventLoop\LoopInterface $loop ) | Sets the event loop dependency. | |
setResolver ( React\Dns\Resolver\Resolver $resolver = null ) | Sets the DNS Resolver. | |
setTickInterval ( float $tickInterval ) | Sets the interval in seconds between irc.tick events. |
Method | Description | |
---|---|---|
addActiveConnection ( Phergie\Irc\ConnectionInterface $connection ) | Add a connection instance to the active connection store | |
addLogging ( Evenement\EventEmitter $emitter, Phergie\Irc\ConnectionInterface $connection ) | Adds an event listener to log data emitted by a stream. | |
addSecureConnection ( Phergie\Irc\ConnectionInterface $connection ) | Initializes a secured connection. | |
addUnsecuredConnection ( Phergie\Irc\ConnectionInterface $connection ) | Initializes an unsecured connection. | |
configureStreams ( Phergie\Irc\ConnectionInterface $connection, React\Stream\DuplexStreamInterface $stream, Phergie\Irc\Client\React\WriteStream $write ) | Configure streams to handle messages received from and sent to the server. | |
emitConnectionError ( Phergie\Irc\Client\React\Exception $exception, Phergie\Irc\ConnectionInterface $connection ) | Emits a connection error event. | |
getContext ( Phergie\Irc\ConnectionInterface $connection ) : array | Derives a set of socket context options for a given connection. | |
getEndCallback ( Phergie\Irc\Client\React\ReadStream $read, Phergie\Irc\Client\React\WriteStream $write, Phergie\Irc\ConnectionInterface $connection, React\EventLoop\Timer\TimerInterface $timer ) : callable | Returns a callback for when a connection is terminated, whether explicitly by the bot or server or as a result of loss of connectivity. | |
getErrorCallback ( Phergie\Irc\ConnectionInterface $connection ) : callable | Returns a callback for proxying connection error events to listeners of the client. | |
getForceIpv4Flag ( Phergie\Irc\ConnectionInterface $connection ) : boolean | Extracts the value of the force-ipv4 option from a given connection. | |
getOutputLogCallback ( Phergie\Irc\ConnectionInterface $connection, string $level, string $prefix = null ) : callable | Generates a closure for stream output logging. | |
getReadCallback ( Phergie\Irc\Client\React\WriteStream $write, Phergie\Irc\ConnectionInterface $connection ) : callable | Returns a callback for proxying IRC events from the read stream to IRC listeners of the client. | |
getReadStream ( Phergie\Irc\ConnectionInterface $connection ) : Phergie\Irc\Client\React\ReadStream | Returns a stream instance for parsing messages from the server and emitting them as events. | |
getRemote ( Phergie\Irc\ConnectionInterface $connection ) : string | Derives a remote for a given connection. | |
getSecureConnector ( ) : React\SocketClient\SecureConnector | Returns a connector for establishing SSL connections. | |
getSocket ( string $remote, array $context ) : resource | Returns a socket configured for a specified remote. | |
getStream ( resource $socket ) : React\Stream\DuplexStreamInterface | Returns a stream for a socket connection. | |
getTickCallback ( Phergie\Irc\Client\React\WriteStream $write, Phergie\Irc\ConnectionInterface $connection ) | Returns a callback executed periodically to allow events to be sent asynchronously versus in response to received or sent events. | |
getTransport ( Phergie\Irc\ConnectionInterface $connection ) : string | Derives the transport for a given connection. | |
getWriteCallback ( Phergie\Irc\Client\React\WriteStream $write, Phergie\Irc\ConnectionInterface $connection ) : callable | Returns a callback for proxying events from the write stream to IRC listeners of the client. | |
getWriteStream ( Phergie\Irc\ConnectionInterface $connection ) : Phergie\Irc\Client\React\WriteStream | Returns a stream instance for sending events to the server. | |
identifyUser ( Phergie\Irc\ConnectionInterface $connection, Phergie\Irc\Client\React\WriteStream $writeStream ) | Identifies the user to a server. | |
initializeConnection ( string $remote, Phergie\Irc\ConnectionInterface $connection ) | Initializes an added connection. | |
initializeStream ( React\Stream\DuplexStreamInterface $stream, Phergie\Irc\ConnectionInterface $connection ) | Configures an established stream for a given connection. | |
processInput ( array $message, Phergie\Irc\Client\React\WriteStream $write, Phergie\Irc\ConnectionInterface $connection ) | There are certain incoming events that the client processes internally. | |
removeActiveConnection ( Phergie\Irc\ConnectionInterface $connection ) | Remove a connection instance from the active connections store |
protected addActiveConnection ( Phergie\Irc\ConnectionInterface $connection ) | ||
$connection | Phergie\Irc\ConnectionInterface |
public addConnection ( Phergie\Irc\ConnectionInterface $connection ) | ||
$connection | Phergie\Irc\ConnectionInterface | Metadata for connection to establish |
protected addLogging ( Evenement\EventEmitter $emitter, Phergie\Irc\ConnectionInterface $connection ) | ||
$emitter | Evenement\EventEmitter | |
$connection | Phergie\Irc\ConnectionInterface | Connection corresponding to the stream |
public addPeriodicTimer ( numeric $interval, callable $callback ) : React\Event\Timer\TimerInterface | ||
$interval | numeric | Number of seconds to wait between executions of callback |
$callback | callable | Callback to execute |
return | React\Event\Timer\TimerInterface | Added timer |
protected addSecureConnection ( Phergie\Irc\ConnectionInterface $connection ) | ||
$connection | Phergie\Irc\ConnectionInterface |
protected addUnsecuredConnection ( Phergie\Irc\ConnectionInterface $connection ) | ||
$connection | Phergie\Irc\ConnectionInterface |
public cancelTimer ( React\EventLoop\Timer\TimerInterface $timer ) | ||
$timer | React\EventLoop\Timer\TimerInterface | Timer returned by addTimer() or addPeriodicTimer() |
protected configureStreams ( Phergie\Irc\ConnectionInterface $connection, React\Stream\DuplexStreamInterface $stream, Phergie\Irc\Client\React\WriteStream $write ) | ||
$connection | Phergie\Irc\ConnectionInterface | Metadata for the connection over which messages are being exchanged |
$stream | React\Stream\DuplexStreamInterface | Stream representing the connection to the server |
$write | Phergie\Irc\Client\React\WriteStream | Stream used to send events to the server |
protected emitConnectionError ( Phergie\Irc\Client\React\Exception $exception, Phergie\Irc\ConnectionInterface $connection ) | ||
$exception | Phergie\Irc\Client\React\Exception | |
$connection | Phergie\Irc\ConnectionInterface |
public getActiveConnections ( ) : Phergie\Irc\ConnectionInterface[] | ||
return | Phergie\Irc\ConnectionInterface[] |
protected getContext ( Phergie\Irc\ConnectionInterface $connection ) : array | ||
$connection | Phergie\Irc\ConnectionInterface | |
return | array | Associative array of context option key-value pairs |
public getDnsServer ( ) : string | ||
return | string |
protected getEndCallback ( Phergie\Irc\Client\React\ReadStream $read, Phergie\Irc\Client\React\WriteStream $write, Phergie\Irc\ConnectionInterface $connection, React\EventLoop\Timer\TimerInterface $timer ) : callable | ||
$read | Phergie\Irc\Client\React\ReadStream | Read stream for this connection |
$write | Phergie\Irc\Client\React\WriteStream | Write stream for this connection |
$connection | Phergie\Irc\ConnectionInterface | Terminated connection |
$timer | React\EventLoop\Timer\TimerInterface | Timer used to handle asynchronously queued events on the connection, which must be cancelled |
return | callable |
protected getErrorCallback ( Phergie\Irc\ConnectionInterface $connection ) : callable | ||
$connection | Phergie\Irc\ConnectionInterface | Connection on which the error occurred |
return | callable |
protected getForceIpv4Flag ( Phergie\Irc\ConnectionInterface $connection ) : boolean | ||
$connection | Phergie\Irc\ConnectionInterface | |
return | boolean | TRUE to force use of IPv4, FALSE otherwise |
public getLogger ( ) : Psr\Log\LoggerInterface | ||
return | Psr\Log\LoggerInterface |
public getLoop ( ) : React\EventLoop\LoopInterface | ||
return | React\EventLoop\LoopInterface |
protected getReadCallback ( Phergie\Irc\Client\React\WriteStream $write, Phergie\Irc\ConnectionInterface $connection ) : callable | ||
$write | Phergie\Irc\Client\React\WriteStream | Write stream corresponding to the read stream on which the event occurred |
$connection | Phergie\Irc\ConnectionInterface | Connection on which the event occurred |
return | callable |
protected getReadStream ( Phergie\Irc\ConnectionInterface $connection ) : Phergie\Irc\Client\React\ReadStream | ||
$connection | Phergie\Irc\ConnectionInterface | Connection corresponding to the read stream |
return | Phergie\Irc\Client\React\ReadStream |
public getResolver ( ) : React\Dns\Resolver\Resolver | ||
return | React\Dns\Resolver\Resolver |
protected getSecureConnector ( ) : React\SocketClient\SecureConnector | ||
return | React\SocketClient\SecureConnector |
protected getStream ( resource $socket ) : React\Stream\DuplexStreamInterface | ||
$socket | resource | Socket for the connection to the server |
return | React\Stream\DuplexStreamInterface |
protected getTickCallback ( Phergie\Irc\Client\React\WriteStream $write, Phergie\Irc\ConnectionInterface $connection ) | ||
$write | Phergie\Irc\Client\React\WriteStream | Stream used to send events to the server |
$connection | Phergie\Irc\ConnectionInterface | Connection to receive the event |
public getTickInterval ( ) : float | ||
return | float |
protected getTransport ( Phergie\Irc\ConnectionInterface $connection ) : string | ||
$connection | Phergie\Irc\ConnectionInterface | |
return | string | Transport usable in the URI for a stream |
protected getWriteCallback ( Phergie\Irc\Client\React\WriteStream $write, Phergie\Irc\ConnectionInterface $connection ) : callable | ||
$write | Phergie\Irc\Client\React\WriteStream | Write stream corresponding to the read stream on which the event occurred |
$connection | Phergie\Irc\ConnectionInterface | Connection on which the event occurred |
return | callable |
protected getWriteStream ( Phergie\Irc\ConnectionInterface $connection ) : Phergie\Irc\Client\React\WriteStream | ||
$connection | Phergie\Irc\ConnectionInterface | Connection corresponding to the read stream |
return | Phergie\Irc\Client\React\WriteStream |
protected identifyUser ( Phergie\Irc\ConnectionInterface $connection, Phergie\Irc\Client\React\WriteStream $writeStream ) | ||
$connection | Phergie\Irc\ConnectionInterface | Connection on which to identify the user |
$writeStream | Phergie\Irc\Client\React\WriteStream | Stream to receive commands identifying the user |
protected initializeConnection ( string $remote, Phergie\Irc\ConnectionInterface $connection ) | ||
$remote | string | |
$connection | Phergie\Irc\ConnectionInterface |
protected initializeStream ( React\Stream\DuplexStreamInterface $stream, Phergie\Irc\ConnectionInterface $connection ) | ||
$stream | React\Stream\DuplexStreamInterface | |
$connection | Phergie\Irc\ConnectionInterface |
public isTimerActive ( React\EventLoop\Timer\TimerInterface $timer ) : boolean | ||
$timer | React\EventLoop\Timer\TimerInterface | Timer returned by addTimer() or addPeriodicTimer() |
return | boolean | TRUE if the specified timer is active, FALSE otherwise |
protected processInput ( array $message, Phergie\Irc\Client\React\WriteStream $write, Phergie\Irc\ConnectionInterface $connection ) | ||
$message | array | Parser output |
$write | Phergie\Irc\Client\React\WriteStream | Write stream corresponding to the read stream on which the event occurred |
$connection | Phergie\Irc\ConnectionInterface | Connection on which the event occurred |
protected removeActiveConnection ( Phergie\Irc\ConnectionInterface $connection ) | ||
$connection | Phergie\Irc\ConnectionInterface |
public setDnsServer ( string $dnsServer = '8.8.8.8' ) | ||
$dnsServer | string |
public setLogger ( Psr\Log\LoggerInterface $logger ) | ||
$logger | Psr\Log\LoggerInterface |
public setLoop ( React\EventLoop\LoopInterface $loop ) | ||
$loop | React\EventLoop\LoopInterface |
public setResolver ( React\Dns\Resolver\Resolver $resolver = null ) | ||
$resolver | React\Dns\Resolver\Resolver |
public setTickInterval ( float $tickInterval ) | ||
$tickInterval | float |
protected SplObjectStorage $activeConnections | ||
return | SplObjectStorage |
protected LoggerInterface,Psr\Log $logger | ||
return | Psr\Log\LoggerInterface |
protected LoopInterface,React\EventLoop $loop | ||
return | React\EventLoop\LoopInterface |
protected Resolver,React\Dns\Resolver $resolver | ||
return | React\Dns\Resolver\Resolver |
protected SecureConnector,React\SocketClient $secureConnector | ||
return | React\SocketClient\SecureConnector |
protected float $tickInterval | ||
return | float |