protected function getIrcMessage($type, array $params = array())
    {
        $message = '';
        if ($this->prefix) {
            $message .= ':' . $this->prefix . ' ';
        }
        $message .= $type;

        $params = array_filter($params, function($param) {
            return $param !== null;
        });
        if ($params) {
            $last = end($params);
            $params[key($params)] = ':' . $last; 
            $message .= ' ' . implode(' ', $params);
        }
        
        $message .= "\r\n";
        return $message;
    }
protected function getIrcMessage($type, array $params = array())
    {
        $message = '';
        if ($this->prefix) {
            $message .= ':' . $this->prefix . ' ';
        }
        $message .= $type;

        $params = array_filter($params, function($param) {
            return $param !== null;
        });
        if ($params) {
            $last = end($params);
            $params[key($params)] = ':' . $last; 
            $message .= ' ' . implode(' ', $params);
        }
        
        $message .= "\r\n";
        return $message;
    }
protected function getIrcMessage ( $ type , array $ params = array ( ) ) { $ message = '' ; if ( $ this -> prefix ) { $ message .= ':' . $ this -> prefix . ' ' ; } $ message .= $ type ; $ params = array_filter ( $ params , function ( $ param ) { return $ param !== null ; } ) ; if ( $ params ) { $ last = end ( $ params ) ; $ params [ key ( $ params ) ] = ':' . $ last ; $ message .= ' ' . implode ( ' ' , $ params ) ; } $ message .= "\r\n" ; return $ message ; }
Returns a formatted IRC message.

@param string $type Command or response code
@param array $params Optional message parameters
@return string
Returns a formatted IRC message .