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

        if ($subcommand === 'get') {
            if ($n !== 2) {
                throw new InvalidArgumentException('ERR Wrong number of arguments for CONFIG get');
            }
            $pattern = func_get_arg(1);
            $ret = array();
            foreach ($this->getConfig() as $name => $value) {
                if (fnmatch($pattern, $name)) {
                    $ret []= $name;
                    $ret []= $value;
                }
            }
            return $ret;
        } elseif ($subcommand === 'set') {
            if ($n !== 3) {
                throw new InvalidArgumentException('ERR Wrong number of arguments for CONFIG set');
            }
            $this->getConfig()->set(func_get_arg(1), func_get_arg(2));
            return true;
        }

        throw new InvalidArgumentException('ERR CONFIG subcommand must be one of GET, SET');
    }
public function config($subcommand)
    {
        $n = func_num_args();
        $subcommand = strtolower($subcommand);

        if ($subcommand === 'get') {
            if ($n !== 2) {
                throw new InvalidArgumentException('ERR Wrong number of arguments for CONFIG get');
            }
            $pattern = func_get_arg(1);
            $ret = array();
            foreach ($this->getConfig() as $name => $value) {
                if (fnmatch($pattern, $name)) {
                    $ret []= $name;
                    $ret []= $value;
                }
            }
            return $ret;
        } elseif ($subcommand === 'set') {
            if ($n !== 3) {
                throw new InvalidArgumentException('ERR Wrong number of arguments for CONFIG set');
            }
            $this->getConfig()->set(func_get_arg(1), func_get_arg(2));
            return true;
        }

        throw new InvalidArgumentException('ERR CONFIG subcommand must be one of GET, SET');
    }
public function config ( $ subcommand ) { $ n = func_num_args ( ) ; $ subcommand = strtolower ( $ subcommand ) ; if ( $ subcommand === 'get' ) { if ( $ n !== 2 ) { throw new InvalidArgumentException ( 'ERR Wrong number of arguments for CONFIG get' ) ; } $ pattern = func_get_arg ( 1 ) ; $ ret = array ( ) ; foreach ( $ this -> getConfig ( ) as $ name => $ value ) { if ( fnmatch ( $ pattern , $ name ) ) { $ ret [ ] = $ name ; $ ret [ ] = $ value ; } } return $ ret ; } elseif ( $ subcommand === 'set' ) { if ( $ n !== 3 ) { throw new InvalidArgumentException ( 'ERR Wrong number of arguments for CONFIG set' ) ; } $ this -> getConfig ( ) -> set ( func_get_arg ( 1 ) , func_get_arg ( 2 ) ) ; return true ; } throw new InvalidArgumentException ( 'ERR CONFIG subcommand must be one of GET, SET' ) ; }
StatusReply
StatusReply