/**
* @TODO
* @param string $from From
* @param string $cmd Command
* @param array $args Arguments
*/
public function commandArr($from, $cmd, $args)
{
if ($from === null) {
$from = $this->pool->config->servername->value;
}
if (is_string($args)) {
Daemon::log(get_class($this) . '->commandArr: args is string');
return;
}
$cmd = IRC::getCodeByCommand($cmd);
$line = ':' . $from . ' ' . $cmd;
for ($i = 0, $s = sizeof($args); $i < $s; ++$i) {
if ($i + 1 === $s && strpos($args[$i], " ") !== false) {
$line .= ' :';
} else {
$line .= ' ';
}
$line .= $args[$i];
}
$this->writeln($line);
if ($this->pool->protologging && $cmd !== 'PONG') {
Daemon::log('=>=>=>=> ' . json_encode($line));
}
}