src/Business/Server.php
public function client($subcommand)
    {
        $n = func_num_args();
        $subcommand = strtolower($subcommand);

        if ($subcommand === 'list' && $n === 1) {
            $ret = '';
            foreach ($this->getAllClients() as $client) {
                $ret .= $client->getDescription() . "\n";
            }
            return $ret;
        } elseif ($subcommand === 'kill' && $n === 2) {
            $this->getClientByIp(func_get_arg(1))->end();
            return true;
        } elseif ($subcommand === 'getname' && $n === 1) {
            return $this->getClient()->getName();
        } elseif ($subcommand === 'setname' && $n === 2) {
            $this->getClient()->setName(func_get_arg(1));

            return true;
        }

        throw new InvalidArgumentException('ERR Syntax error, try CLIENT (LIST | KILL ip:port | GETNAME | SETNAME connection-name)');
    }
public function client($subcommand)
    {
        $n = func_num_args();
        $subcommand = strtolower($subcommand);

        if ($subcommand === 'list' && $n === 1) {
            $ret = '';
            foreach ($this->getAllClients() as $client) {
                $ret .= $client->getDescription() . "\n";
            }
            return $ret;
        } elseif ($subcommand === 'kill' && $n === 2) {
            $this->getClientByIp(func_get_arg(1))->end();
            return true;
        } elseif ($subcommand === 'getname' && $n === 1) {
            return $this->getClient()->getName();
        } elseif ($subcommand === 'setname' && $n === 2) {
            $this->getClient()->setName(func_get_arg(1));

            return true;
        }

        throw new InvalidArgumentException('ERR Syntax error, try CLIENT (LIST | KILL ip:port | GETNAME | SETNAME connection-name)');
    }
public function client ( $ subcommand ) { $ n = func_num_args ( ) ; $ subcommand = strtolower ( $ subcommand ) ; if ( $ subcommand === 'list' && $ n === 1 ) { $ ret = '' ; foreach ( $ this -> getAllClients ( ) as $ client ) { $ ret .= $ client -> getDescription ( ) . "\n" ; } return $ ret ; } elseif ( $ subcommand === 'kill' && $ n === 2 ) { $ this -> getClientByIp ( func_get_arg ( 1 ) ) -> end ( ) ; return true ; } elseif ( $ subcommand === 'getname' && $ n === 1 ) { return $ this -> getClient ( ) -> getName ( ) ; } elseif ( $ subcommand === 'setname' && $ n === 2 ) { $ this -> getClient ( ) -> setName ( func_get_arg ( 1 ) ) ; return true ; } throw new InvalidArgumentException ( 'ERR Syntax error, try CLIENT (LIST | KILL ip:port | GETNAME | SETNAME connection-name)' ) ; }
StatusReply
StatusReply