getCommandByCode() public static method

public static getCommandByCode ( integer $code ) : string
$code integer Code
return string
Ejemplo n.º 1
0
 /**
  * @TODO DESCR
  * @param  integer|string $cmd
  * @param  array $args
  * @return bool
  */
 public function commandArr($cmd, $args = [])
 {
     if (!is_array($args)) {
         return false;
     }
     if (ctype_digit($cmd)) {
         $cmd = IRC::getCommandByCode((int) $cmd);
     }
     $line = $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 && !in_array($cmd, ['PONG'])) {
         Daemon::log('->->->-> ' . $line);
     }
     return true;
 }