private function parseArgs($args) {
        $command = $action = null;
        $params = [];
        foreach ($args as $argument) {
            if ('-' != $argument[0])
                if (null === $command)
                    $command = $argument;
                elseif (null === $action)
                    $action = $argument;
                else
                    $this->alert('Invalid argument ' . $argument . '!', ['command' => $command, 'action' => $action, 'serverArguments' => $_SERVER['argv'], 'processedArguments' => $args]);
            else {
                $argument = substr($argument, 1); // supports both  one - or two - ( - / -- )
                if ('-' == $argument[0])
                    $argument = substr($argument, 1);

                $argument = explode('=', $argument, 2);
                $params[$argument[0]] = isset($argument[1]) ? $argument[1] : true;
            }
        }
        return [
            'command' => $command,
            'action' => $action,
            'params' => $params
        ];
    }
private function parseArgs($args) {
        $command = $action = null;
        $params = [];
        foreach ($args as $argument) {
            if ('-' != $argument[0])
                if (null === $command)
                    $command = $argument;
                elseif (null === $action)
                    $action = $argument;
                else
                    $this->alert('Invalid argument ' . $argument . '!', ['command' => $command, 'action' => $action, 'serverArguments' => $_SERVER['argv'], 'processedArguments' => $args]);
            else {
                $argument = substr($argument, 1); // supports both  one - or two - ( - / -- )
                if ('-' == $argument[0])
                    $argument = substr($argument, 1);

                $argument = explode('=', $argument, 2);
                $params[$argument[0]] = isset($argument[1]) ? $argument[1] : true;
            }
        }
        return [
            'command' => $command,
            'action' => $action,
            'params' => $params
        ];
    }
private function parseArgs ( $ args ) { $ command = $ action = null ; $ params = [ ] ; foreach ( $ args as $ argument ) { if ( '-' != $ argument [ 0 ] ) if ( null === $ command ) $ command = $ argument ; elseif ( null === $ action ) $ action = $ argument ; else $ this -> alert ( 'Invalid argument ' . $ argument . '!' , [ 'command' => $ command , 'action' => $ action , 'serverArguments' => $ _SERVER [ 'argv' ] , 'processedArguments' => $ args ] ) ; else { $ argument = substr ( $ argument , 1 ) ; // supports both  one - or two - ( - / -- ) if ( '-' == $ argument [ 0 ] ) $ argument = substr ( $ argument , 1 ) ; $ argument = explode ( '=' , $ argument , 2 ) ; $ params [ $ argument [ 0 ] ] = isset ( $ argument [ 1 ] ) ? $ argument [ 1 ] : true ; } } return [ 'command' => $ command , 'action' => $ action , 'params' => $ params ] ; }
Receives a list of strings and extracts the command, action and parameters from that list.

@param string[] $args
@return string[]
Receives a list of strings and extracts the command action and parameters from that list .