/** * Create a parsed IRC message from string. * @param string $ircMessage The string to be parsed. * @throws InvalidArgumentException */ public function __construct($ircMessage) { if (!is_string($ircMessage) || empty($ircMessage)) { throw new InvalidArgumentException('ircMessage is of invalid type or empty: expected string, got ' . gettype($ircMessage) . '.'); } $parser = new PhergieParser(); $this->message = $parser->parse($ircMessage); }
/** * Tests consumeAll(). * * @param string $message Parameter for consumeAll() call * @param array|null $result Expected return value of consumeAll() * @dataProvider dataProviderTestParseAll * @see \Phergie\Irc\Parser::consumeAll() */ public function testConsumeAll($message, $result) { $parser = new Parser(); $this->assertEquals($result, $parser->consumeAll($message)); if ($result) { $last = $result; if (isset($result['tail'])) { $this->assertEquals($message, $result['tail']); } } }