$message
$message : string
Regular expression to match a single IRC message
Canonical implementation of ParserInterface.
parse(string $message) : array|null
Implements ParserInterface::parse().
array(
'prefix' => ':Angel',
'nick' => 'Angel',
'command' => 'USER',
'params' => array(
'username' => 'guest',
'hostname' => 'tolmoon',
'servername' => 'tolsun',
'realname' => 'Ronnie Regan',
'all' => 'guest tolmoon tolsun :Ronnie Regan',
),
'targets' => array('guest'),
'message' => "USER guest tolmoon tolsun :Ronnie Regan\r\n",
'tail' => 'NICK :Wiz',
),
The prefix and its components and individual targets as described in Section 2.3.1 of RFC 1459 are referenced by the 'prefix' and 'targets' keys, respectively. A string containing the first full parsed message is referenced by the 'message' key. Any remaining data after the first message is referenced by the 'tail' key. The command and its parameters are referenced by the 'command' and 'params' keys, respectively. Keys used for parameters follow the naming conventions described in Section 4 of RFC 1459. See unit tests for Phergie\Irc\Parser for examples.
string | $message | Data stream containing the message to parse |
Associative array containing parsed data if the
message is successfully parsed, null otherwise
parseAll(string $message) : array
Implements ParserInterface::parseAll().
string | $message | String containing the message to parse |
Enumerated array of associative arrays each containing
parsed data for a single message if any messages are
successfully parsed, an empty array otherwise
consumeAll(string $message) : array
Implements ParserInterface::consumeAll().
string | $message | String containing the message to parse |
Enumerated array of associative arrays each containing
parsed data for a single message if any messages are
successfully parsed, an empty array otherwise