public function command($from, $cmd)
{
if ($from === null) {
$from = $this->pool->config->servername->value;
}
$cmd = IRC::getCodeByCommand($cmd);
$line = ':' . $from . ' ' . $cmd;
for ($i = 2, $s = func_num_args(); $i < $s; ++$i) {
$arg = func_get_arg($i);
if ($i + 1 === $s && mb_orig_strpos($arg, " ") !== false) {
$line .= ' :';
} else {
$line .= ' ';
}
$line .= $arg;
}
$this->writeln($line);
if ($this->pool->protologging && $cmd !== 'PONG') {
Daemon::log('=>=>=>=> ' . json_encode($line));
}
}