for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Jerodev\PhpIrcClient\Messages;
class IrcMessage
{
/** @var string */
private $rawMessage;
public $command;
public $commandsuffix;
public $payload;
public $source;
public function __construct(string $message)
$this->rawMessage = $message;
if (preg_match('/^(?::(?<source>[^\s]+)\s*)?(?<command>[^\s]+)\s*(?<commandsuffix>[^:$]+)?\s*(?::(?<payload>.*?))?$/', $message, $matches)) {
$this->source = $matches['source'] ?? null;
$this->command = $matches['command'] ?? null;
$this->commandsuffix = trim($matches['commandsuffix'] ?? null);
$this->payload = $matches['payload'] ?? null;
}
/**
* Get the raw message line.
*
* @return string
*/
public function getRaw(): string
return $this->rawMessage;