PHP Class Phergie_Driver_Streams, phergie

Author: Phergie Development Team ([email protected])
Inheritance: extends Phergie_Driver_Abstract
Afficher le fichier Open project: phergie/phergie Class Usage Examples

Protected Properties

Свойство Type Description
$socket resource Reference to the currently active socket handler
$sockets array Socket handlers
$timeout float Amount of time in seconds to wait to receive an event each time the socket is polled

Méthodes publiques

Méthode Description
doAction ( string $target, string $text ) : void Sends a CTCP ACTION (/me) command to a nick or channel.
doConnect ( ) : void Initiates a connection with the server.
doFinger ( string $nick, string $finger = null ) : void Sends a CTCP FINGER request to a user.
doInvite ( string $nick, string $channel ) : void Invites a user to an invite-only channel.
doJoin ( string $channels, string $keys = null ) : void Joins a channel.
doKick ( string $nick, string $channel, string $reason = null ) : void Kicks a user from a channel.
doList ( string $channels = null ) : void Obtains a list of channel names and topics.
doMode ( string $target, string $mode = null, string $param = null ) : void Retrieves or changes a channel or user mode.
doNames ( string $channels ) : void Obtains a list of nicks of usrs in currently joined channels.
doNick ( string $nick ) : void Changes the client nick.
doNotice ( string $target, string $text ) : void Sends a notice to a nick or channel.
doPart ( string $channels ) : void Leaves a channel.
doPing ( string $nick, string $hash ) : void Sends a CTCP PING request or response (they are identical) to a user.
doPong ( string $daemon ) : void Responds to a server test of client responsiveness.
doPrivmsg ( string $target, string $text ) : void Sends a message to a nick or channel.
doQuit ( string $reason = null ) : void Terminates the connection with the server.
doRaw ( string $command ) : void Sends a raw command to the server.
doTime ( string $nick, string $time = null ) : void Sends a CTCP TIME request to a user.
doTopic ( string $channel, string $topic = null ) : void Retrieves or changes a channel topic.
doVersion ( string $nick, string $version = null ) : void Sends a CTCP VERSION request or response to a user.
doWhois ( string $nick ) : void Retrieves information about a nick.
getActiveReadSockets ( integer $sec, integer $usec = 200000 ) : array Returns a list of hostmasks corresponding to sockets with data to read.
getEvent ( ) : Phergie_Event_Interface | null Listens for an event on the current connection.
getTimeout ( ) : float Returns the amount of time to wait for a new event each time the socket is polled.
setConnection ( Phergie_Connection $connection ) : Phergie_Driver_Streams Overrides the parent class to set the currently active socket handler when the active connection is changed.
setTimeout ( float $timeout ) : Phergie_Driver_Streams Sets the amount of time to wait for a new event each time the socket is polled.

Méthodes protégées

Méthode Description
connect ( string $remote, &$errno, &$errstr, array $context = [] ) : resource Establishes a socket connection, separatedly mainly to allow for stubbing during unit testing.
doCtcp ( string $nick, string $command, string $args = null ) : void Sends a CTCP response to a user.
parseArguments ( string $args, integer $count ) : array Supporting method to parse event argument strings where the last argument may contain a colon.
send ( string $command, string | array $args = '' ) : string Handles construction of command strings and their transmission to the server.
write ( string $data ) : integer Writes data to the socket, separatedly mainly to allow for stubbing during unit testing.

Method Details

connect() protected méthode

Establishes a socket connection, separatedly mainly to allow for stubbing during unit testing.
protected connect ( string $remote, &$errno, &$errstr, array $context = [] ) : resource
$remote string Address to connect the socket to
$context array Optional socket context options
Résultat resource Established socket

doAction() public méthode

Sends a CTCP ACTION (/me) command to a nick or channel.
public doAction ( string $target, string $text ) : void
$target string Channel name or user nick
$text string Text of the action to perform
Résultat void

doConnect() public méthode

Initiates a connection with the server.
public doConnect ( ) : void
Résultat void

doCtcp() protected méthode

Sends a CTCP response to a user.
protected doCtcp ( string $nick, string $command, string $args = null ) : void
$nick string User nick
$command string Command to send
$args string Sequential arguments (optional)
Résultat void

doFinger() public méthode

Sends a CTCP FINGER request to a user.
public doFinger ( string $nick, string $finger = null ) : void
$nick string User nick
$finger string Finger string to send for a response
Résultat void

doInvite() public méthode

Invites a user to an invite-only channel.
public doInvite ( string $nick, string $channel ) : void
$nick string Nick of the user to invite
$channel string Name of the channel
Résultat void

doJoin() public méthode

Joins a channel.
public doJoin ( string $channels, string $keys = null ) : void
$channels string Comma-delimited list of channels to join
$keys string Optional comma-delimited list of channel keys
Résultat void

doKick() public méthode

Kicks a user from a channel.
public doKick ( string $nick, string $channel, string $reason = null ) : void
$nick string Nick of the user
$channel string Channel name
$reason string Reason for the kick (optional)
Résultat void

doList() public méthode

Obtains a list of channel names and topics.
public doList ( string $channels = null ) : void
$channels string Comma-delimited list of one or more channels to which the response should be restricted (optional)
Résultat void

doMode() public méthode

Retrieves or changes a channel or user mode.
public doMode ( string $target, string $mode = null, string $param = null ) : void
$target string Channel name or user nick
$mode string New mode to assign (optional)
$param string User limit when $mode is 'l', user hostmask when $mode is 'b', or user nick when $mode is 'o'
Résultat void

doNames() public méthode

Obtains a list of nicks of usrs in currently joined channels.
public doNames ( string $channels ) : void
$channels string Comma-delimited list of one or more channels
Résultat void

doNick() public méthode

Changes the client nick.
public doNick ( string $nick ) : void
$nick string New nick to assign
Résultat void

doNotice() public méthode

Sends a notice to a nick or channel.
public doNotice ( string $target, string $text ) : void
$target string Channel name or user nick
$text string Text of the notice to send
Résultat void

doPart() public méthode

Leaves a channel.
public doPart ( string $channels ) : void
$channels string Comma-delimited list of channels to leave
Résultat void

doPing() public méthode

Sends a CTCP PING request or response (they are identical) to a user.
public doPing ( string $nick, string $hash ) : void
$nick string User nick
$hash string Hash to use in the handshake
Résultat void

doPong() public méthode

Responds to a server test of client responsiveness.
public doPong ( string $daemon ) : void
$daemon string Daemon from which the original request originates
Résultat void

doPrivmsg() public méthode

Sends a message to a nick or channel.
public doPrivmsg ( string $target, string $text ) : void
$target string Channel name or user nick
$text string Text of the message to send
Résultat void

doQuit() public méthode

Terminates the connection with the server.
public doQuit ( string $reason = null ) : void
$reason string Reason for connection termination (optional)
Résultat void

doRaw() public méthode

Sends a raw command to the server.
public doRaw ( string $command ) : void
$command string Command string to send
Résultat void

doTime() public méthode

Sends a CTCP TIME request to a user.
public doTime ( string $nick, string $time = null ) : void
$nick string User nick
$time string Time string to send for a response
Résultat void

doTopic() public méthode

Retrieves or changes a channel topic.
public doTopic ( string $channel, string $topic = null ) : void
$channel string Name of the channel
$topic string New topic to assign (optional)
Résultat void

doVersion() public méthode

Sends a CTCP VERSION request or response to a user.
public doVersion ( string $nick, string $version = null ) : void
$nick string User nick
$version string Version string to send for a response
Résultat void

doWhois() public méthode

Retrieves information about a nick.
public doWhois ( string $nick ) : void
$nick string Nick
Résultat void

getActiveReadSockets() public méthode

Returns a list of hostmasks corresponding to sockets with data to read.
public getActiveReadSockets ( integer $sec, integer $usec = 200000 ) : array
$sec integer Length of time to wait for new data (seconds)
$usec integer Length of time to wait for new data (microseconds)
Résultat array List of hostmasks or an empty array if none were found to have data to read

getEvent() public méthode

Listens for an event on the current connection.
public getEvent ( ) : Phergie_Event_Interface | null
Résultat Phergie_Event_Interface | null Event instance if an event was received, NULL otherwise

getTimeout() public méthode

Returns the amount of time to wait for a new event each time the socket is polled.
public getTimeout ( ) : float
Résultat float Amount of time in seconds

parseArguments() protected méthode

Supporting method to parse event argument strings where the last argument may contain a colon.
protected parseArguments ( string $args, integer $count ) : array
$args string Argument string to parse
$count integer Optional maximum number of arguments
Résultat array Array of argument values

send() protected méthode

Handles construction of command strings and their transmission to the server.
protected send ( string $command, string | array $args = '' ) : string
$command string Command to send
$args string | array Optional string or array of sequential arguments
Résultat string Command string that was sent

setConnection() public méthode

Overrides the parent class to set the currently active socket handler when the active connection is changed.
public setConnection ( Phergie_Connection $connection ) : Phergie_Driver_Streams
$connection Phergie_Connection Active connection
Résultat Phergie_Driver_Streams Provides a fluent interface

setTimeout() public méthode

Sets the amount of time to wait for a new event each time the socket is polled.
public setTimeout ( float $timeout ) : Phergie_Driver_Streams
$timeout float Amount of time in seconds
Résultat Phergie_Driver_Streams Provides a fluent interface

write() protected méthode

Writes data to the socket, separatedly mainly to allow for stubbing during unit testing.
protected write ( string $data ) : integer
$data string Data to write to the socket
Résultat integer Number of bytes successfully written to the socket

Property Details

$socket protected_oe property

Reference to the currently active socket handler
protected resource $socket
Résultat resource

$sockets protected_oe property

Socket handlers
protected array $sockets
Résultat array

$timeout protected_oe property

Amount of time in seconds to wait to receive an event each time the socket is polled
protected float $timeout
Résultat float