PHP 클래스 Phergie\Irc\Client\React\Client

상속: extends Evenement\EventEmitter, implements Phergie\Irc\Client\React\ClientInterface, implements Phergie\Irc\Client\React\LoopAwareInterface, implements Phergie\Irc\Client\React\LoopAccessorInterface
파일 보기 프로젝트 열기: phergie/phergie-irc-client-react 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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

공개 메소드들

메소드 설명
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.

보호된 메소드들

메소드 설명
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

메소드 상세

addActiveConnection() 보호된 메소드

Add a connection instance to the active connection store
protected addActiveConnection ( Phergie\Irc\ConnectionInterface $connection )
$connection Phergie\Irc\ConnectionInterface

addConnection() 공개 메소드

Emits connect.before.each and connect.after.each events before and after connection attempts are established, respectively. Emits a connect.error event if a connection attempt fails.
public addConnection ( Phergie\Irc\ConnectionInterface $connection )
$connection Phergie\Irc\ConnectionInterface Metadata for connection to establish

addLogging() 보호된 메소드

Adds an event listener to log data emitted by a stream.
protected addLogging ( Evenement\EventEmitter $emitter, Phergie\Irc\ConnectionInterface $connection )
$emitter Evenement\EventEmitter
$connection Phergie\Irc\ConnectionInterface Connection corresponding to the stream

addPeriodicTimer() 공개 메소드

Adds a recurring callback to execute on a specified interval. Proxies to addPeriodTimer() implementation of the event loop implementation returned by getLoop().
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
리턴 React\Event\Timer\TimerInterface Added timer

addSecureConnection() 보호된 메소드

Initializes a secured connection.
protected addSecureConnection ( Phergie\Irc\ConnectionInterface $connection )
$connection Phergie\Irc\ConnectionInterface

addTimer() 공개 메소드

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().
public addTimer ( numeric $interval, callable $callback ) : React\Event\Timer\TimerInterface
$interval numeric Number of seconds to wait before executing callback
$callback callable Callback to execute
리턴 React\Event\Timer\TimerInterface Added timer

addUnsecuredConnection() 보호된 메소드

Initializes an unsecured connection.
protected addUnsecuredConnection ( Phergie\Irc\ConnectionInterface $connection )
$connection Phergie\Irc\ConnectionInterface

cancelTimer() 공개 메소드

Cancels a specified timer created using addTimer() or addPeriodicTimer(). Proxies to the cancelTimer() implementation of the event loop implementation returned by getLoop().
public cancelTimer ( React\EventLoop\Timer\TimerInterface $timer )
$timer React\EventLoop\Timer\TimerInterface Timer returned by addTimer() or addPeriodicTimer()

configureStreams() 보호된 메소드

Configure streams to handle messages received from and sent to the server.
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

emitConnectionError() 보호된 메소드

Emits a connection error event.
protected emitConnectionError ( Phergie\Irc\Client\React\Exception $exception, Phergie\Irc\ConnectionInterface $connection )
$exception Phergie\Irc\Client\React\Exception
$connection Phergie\Irc\ConnectionInterface

getActiveConnections() 공개 메소드

Gets an array of all connections associated with an active socket stream.
public getActiveConnections ( ) : Phergie\Irc\ConnectionInterface[]
리턴 Phergie\Irc\ConnectionInterface[]

getContext() 보호된 메소드

Derives a set of socket context options for a given connection.
protected getContext ( Phergie\Irc\ConnectionInterface $connection ) : array
$connection Phergie\Irc\ConnectionInterface
리턴 array Associative array of context option key-value pairs

getDnsServer() 공개 메소드

Returns the configured DNS server
public getDnsServer ( ) : string
리턴 string

getEndCallback() 보호된 메소드

Returns a callback for when a connection is terminated, whether explicitly by the bot or server or as a result of loss of connectivity.
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
리턴 callable

getErrorCallback() 보호된 메소드

Returns a callback for proxying connection error events to listeners of the client.
protected getErrorCallback ( Phergie\Irc\ConnectionInterface $connection ) : callable
$connection Phergie\Irc\ConnectionInterface Connection on which the error occurred
리턴 callable

getForceIpv4Flag() 보호된 메소드

Extracts the value of the force-ipv4 option from a given connection.
protected getForceIpv4Flag ( Phergie\Irc\ConnectionInterface $connection ) : boolean
$connection Phergie\Irc\ConnectionInterface
리턴 boolean TRUE to force use of IPv4, FALSE otherwise

getLogger() 공개 메소드

Returns a stream instance for logging data on the socket connection.
public getLogger ( ) : Psr\Log\LoggerInterface
리턴 Psr\Log\LoggerInterface

getLoop() 공개 메소드

Returns the event loop dependency, initializing it if needed.
public getLoop ( ) : React\EventLoop\LoopInterface
리턴 React\EventLoop\LoopInterface

getOutputLogCallback() 보호된 메소드

Generates a closure for stream output logging.
protected getOutputLogCallback ( Phergie\Irc\ConnectionInterface $connection, string $level, string $prefix = null ) : callable
$connection Phergie\Irc\ConnectionInterface
$level string Evenement logging level to use
$prefix string Prefix string for log lines (optional)
리턴 callable

getReadCallback() 보호된 메소드

Returns a callback for proxying IRC events from the read stream to IRC listeners of the client.
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
리턴 callable

getReadStream() 보호된 메소드

Returns a stream instance for parsing messages from the server and emitting them as events.
protected getReadStream ( Phergie\Irc\ConnectionInterface $connection ) : Phergie\Irc\Client\React\ReadStream
$connection Phergie\Irc\ConnectionInterface Connection corresponding to the read stream
리턴 Phergie\Irc\Client\React\ReadStream

getRemote() 보호된 메소드

Derives a remote for a given connection.
protected getRemote ( Phergie\Irc\ConnectionInterface $connection ) : string
$connection Phergie\Irc\ConnectionInterface
리턴 string Remote usable to establish a socket connection

getResolver() 공개 메소드

Get the DNS Resolver, if one isn't set in instance will be created.
public getResolver ( ) : React\Dns\Resolver\Resolver
리턴 React\Dns\Resolver\Resolver

getSecureConnector() 보호된 메소드

Returns a connector for establishing SSL connections.
protected getSecureConnector ( ) : React\SocketClient\SecureConnector
리턴 React\SocketClient\SecureConnector

getSocket() 보호된 메소드

Returns a socket configured for a specified remote.
protected getSocket ( string $remote, array $context ) : resource
$remote string Address to connect the socket to (e.g. tcp://irc.freenode.net:6667)
$context array Context options for the socket
리턴 resource

getStream() 보호된 메소드

Returns a stream for a socket connection.
protected getStream ( resource $socket ) : React\Stream\DuplexStreamInterface
$socket resource Socket for the connection to the server
리턴 React\Stream\DuplexStreamInterface

getTickCallback() 보호된 메소드

Returns a callback executed periodically to allow events to be sent asynchronously versus in response to received or sent events.
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

getTickInterval() 공개 메소드

Returns the interval in seconds between irc.tick events.
public getTickInterval ( ) : float
리턴 float

getTransport() 보호된 메소드

Derives the transport for a given connection.
protected getTransport ( Phergie\Irc\ConnectionInterface $connection ) : string
$connection Phergie\Irc\ConnectionInterface
리턴 string Transport usable in the URI for a stream

getWriteCallback() 보호된 메소드

Returns a callback for proxying events from the write stream to IRC listeners of the client.
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
리턴 callable

getWriteStream() 보호된 메소드

Returns a stream instance for sending events to the server.
protected getWriteStream ( Phergie\Irc\ConnectionInterface $connection ) : Phergie\Irc\Client\React\WriteStream
$connection Phergie\Irc\ConnectionInterface Connection corresponding to the read stream
리턴 Phergie\Irc\Client\React\WriteStream

identifyUser() 보호된 메소드

Identifies the user to a server.
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

initializeConnection() 보호된 메소드

Initializes an added connection.
protected initializeConnection ( string $remote, Phergie\Irc\ConnectionInterface $connection )
$remote string
$connection Phergie\Irc\ConnectionInterface

initializeStream() 보호된 메소드

Configures an established stream for a given connection.
protected initializeStream ( React\Stream\DuplexStreamInterface $stream, Phergie\Irc\ConnectionInterface $connection )
$stream React\Stream\DuplexStreamInterface
$connection Phergie\Irc\ConnectionInterface

isTimerActive() 공개 메소드

Checks if a timer created using addTimer() or addPeriodicTimer() is active. Proxies to the isTimerActive() implementation of the event loop implementation returned by getLoop().
public isTimerActive ( React\EventLoop\Timer\TimerInterface $timer ) : boolean
$timer React\EventLoop\Timer\TimerInterface Timer returned by addTimer() or addPeriodicTimer()
리턴 boolean TRUE if the specified timer is active, FALSE otherwise

processInput() 보호된 메소드

These functions are essential to the client-server relationship: for example, updating the connection's stored nickname, responding to PING events, etc. Any user-level IRC functionality handled internally by the client should be implemented here.
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

removeActiveConnection() 보호된 메소드

Remove a connection instance from the active connections store
protected removeActiveConnection ( Phergie\Irc\ConnectionInterface $connection )
$connection Phergie\Irc\ConnectionInterface

run() 공개 메소드

Executes the event loop, which continues running until no active connections remain.
public run ( Phergie\Irc\ConnectionInterface | Phergie\Irc\ConnectionInterface[] $connections, boolean $autorun = true )
$connections Phergie\Irc\ConnectionInterface | Phergie\Irc\ConnectionInterface[]
$autorun boolean

setDnsServer() 공개 메소드

Set the DNS server to use when looking up IP's
public setDnsServer ( string $dnsServer = '8.8.8.8' )
$dnsServer string

setLogger() 공개 메소드

Sets a logger for logging data on the socket connection.
public setLogger ( Psr\Log\LoggerInterface $logger )
$logger Psr\Log\LoggerInterface

setLoop() 공개 메소드

Sets the event loop dependency.
public setLoop ( React\EventLoop\LoopInterface $loop )
$loop React\EventLoop\LoopInterface

setResolver() 공개 메소드

Sets the DNS Resolver.
public setResolver ( React\Dns\Resolver\Resolver $resolver = null )
$resolver React\Dns\Resolver\Resolver

setTickInterval() 공개 메소드

Sets the interval in seconds between irc.tick events.
public setTickInterval ( float $tickInterval )
$tickInterval float

프로퍼티 상세

$activeConnections 보호되어 있는 프로퍼티

Contains all connection instances associated with an active socket stream
protected SplObjectStorage $activeConnections
리턴 SplObjectStorage

$dnsServer 보호되어 있는 프로퍼티

protected string $dnsServer
리턴 string

$logger 보호되어 있는 프로퍼티

Logging stream
protected LoggerInterface,Psr\Log $logger
리턴 Psr\Log\LoggerInterface

$loop 보호되어 있는 프로퍼티

Event loop
protected LoopInterface,React\EventLoop $loop
리턴 React\EventLoop\LoopInterface

$resolver 보호되어 있는 프로퍼티

protected Resolver,React\Dns\Resolver $resolver
리턴 React\Dns\Resolver\Resolver

$secureConnector 보호되어 있는 프로퍼티

Connector used to establish SSL connections
protected SecureConnector,React\SocketClient $secureConnector
리턴 React\SocketClient\SecureConnector

$tickInterval 보호되어 있는 프로퍼티

Interval in seconds between irc.tick events
protected float $tickInterval
리턴 float