protected function searchCommand(string $name):array
    {
        $f = $this->fileCommand;
        $finalC = array();
        if ($f == null) {
            throw new Server500(new \ArrayObject(array("explain" =>
                "Framework Console Arguments Error : Command File is empty",
                "solution" => "Command file not be empty")));
        }
        $commands = $f->commands;

        foreach ($commands as $command => $val) {
            if ($val->type === "single") {
                if ($command == $name) {
                    return (array("name" => $command, "class" => $val->class, "desc" => $val->desc));
                }
            } elseif ($val->type === "multiple") {
                foreach ($val->args as $aval) {
                    if ($aval->name === $name) {
                        return (array("name" => $aval->name, "class" => $val->class, "desc" => $aval->desc));
                    }
                }
            } else {
                throw new Server500(new \ArrayObject(array("explain" => "Undefined command type [".$val->type."]",
                    "solution" => "Please set a valid command type [single, multiple]")));
            }
        }
        return ($finalC);
    }
protected function searchCommand(string $name):array
    {
        $f = $this->fileCommand;
        $finalC = array();
        if ($f == null) {
            throw new Server500(new \ArrayObject(array("explain" =>
                "Framework Console Arguments Error : Command File is empty",
                "solution" => "Command file not be empty")));
        }
        $commands = $f->commands;

        foreach ($commands as $command => $val) {
            if ($val->type === "single") {
                if ($command == $name) {
                    return (array("name" => $command, "class" => $val->class, "desc" => $val->desc));
                }
            } elseif ($val->type === "multiple") {
                foreach ($val->args as $aval) {
                    if ($aval->name === $name) {
                        return (array("name" => $aval->name, "class" => $val->class, "desc" => $aval->desc));
                    }
                }
            } else {
                throw new Server500(new \ArrayObject(array("explain" => "Undefined command type [".$val->type."]",
                    "solution" => "Please set a valid command type [single, multiple]")));
            }
        }
        return ($finalC);
    }
protected function searchCommand ( string $ name ) : array { $ f = $ this -> fileCommand ; $ finalC = array ( ) ; if ( $ f == null ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Framework Console Arguments Error : Command File is empty" , "solution" => "Command file not be empty" ) ) ) ; } $ commands = $ f -> commands ; foreach ( $ commands as $ command => $ val ) { if ( $ val -> type === "single" ) { if ( $ command == $ name ) { return ( array ( "name" => $ command , "class" => $ val -> class , "desc" => $ val -> desc ) ) ; } } elseif ( $ val -> type === "multiple" ) { foreach ( $ val -> args as $ aval ) { if ( $ aval -> name === $ name ) { return ( array ( "name" => $ aval -> name , "class" => $ val -> class , "desc" => $ aval -> desc ) ) ; } } } else { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Undefined command type [" . $ val -> type . "]" , "solution" => "Please set a valid command type [single, multiple]" ) ) ) ; } } return ( $ finalC ) ; }
Search a command name
@param string $name Command name
@return array Search result as an array
@throws \Exception Exception will generate of is an empty file
Search a command name