public function processArgs( ICommand &$command, $args )
    {
        $i = 0;

        $ops = array_slice( $args, 2 );

        while ( $i < count( $ops ) )
        {
            $o = $ops[ $i ];

            if ( Option::isShortCode( $o ) || Option::isLongCode( $o ) )
            {
                $option = Command::getOption( $command, $o );

                if ( $option->isRequired )
                {
                    $i++;

                    if ( !Util::validIndex( $i, $ops ) )
                    {
                        throw new CommandException( 'Missing argument for option: ' . $o );
                    }

                    Option::setRequiredValue( $option, $ops[ $i ] );
                }

                if ( $option->isOptional )
                {
                    $value = NULL;

                    if ( $option->type === Type::BOOLEAN )
                    {
                        $value = TRUE;
                    }
                    else
                    {
                        $i++;

                        $value = $ops[ $i ];
                    }

                    if ( Util::validIndex( $i, $ops ) )
                    {
                        Option::setOptionalValue( $option, $value );
                    }
                    else if ( is_bool( $value ) )
                    {
                        Option::setOptionalValue( $option, $value );
                    }
                }
            }

            $i++;
        }
    }
public function processArgs( ICommand &$command, $args )
    {
        $i = 0;

        $ops = array_slice( $args, 2 );

        while ( $i < count( $ops ) )
        {
            $o = $ops[ $i ];

            if ( Option::isShortCode( $o ) || Option::isLongCode( $o ) )
            {
                $option = Command::getOption( $command, $o );

                if ( $option->isRequired )
                {
                    $i++;

                    if ( !Util::validIndex( $i, $ops ) )
                    {
                        throw new CommandException( 'Missing argument for option: ' . $o );
                    }

                    Option::setRequiredValue( $option, $ops[ $i ] );
                }

                if ( $option->isOptional )
                {
                    $value = NULL;

                    if ( $option->type === Type::BOOLEAN )
                    {
                        $value = TRUE;
                    }
                    else
                    {
                        $i++;

                        $value = $ops[ $i ];
                    }

                    if ( Util::validIndex( $i, $ops ) )
                    {
                        Option::setOptionalValue( $option, $value );
                    }
                    else if ( is_bool( $value ) )
                    {
                        Option::setOptionalValue( $option, $value );
                    }
                }
            }

            $i++;
        }
    }
public function processArgs ( ICommand & $ command , $ args ) { $ i = 0 ; $ ops = array_slice ( $ args , 2 ) ; while ( $ i < count ( $ ops ) ) { $ o = $ ops [ $ i ] ; if ( Option :: isShortCode ( $ o ) || Option :: isLongCode ( $ o ) ) { $ option = Command :: getOption ( $ command , $ o ) ; if ( $ option -> isRequired ) { $ i ++ ; if ( ! Util :: validIndex ( $ i , $ ops ) ) { throw new CommandException ( 'Missing argument for option: ' . $ o ) ; } Option :: setRequiredValue ( $ option , $ ops [ $ i ] ) ; } if ( $ option -> isOptional ) { $ value = NULL ; if ( $ option -> type === Type :: BOOLEAN ) { $ value = TRUE ; } else { $ i ++ ; $ value = $ ops [ $ i ] ; } if ( Util :: validIndex ( $ i , $ ops ) ) { Option :: setOptionalValue ( $ option , $ value ) ; } else if ( is_bool ( $ value ) ) { Option :: setOptionalValue ( $ option , $ value ) ; } } } $ i ++ ; } }
Processes the command line arguments and sets the option
values for the command.

@param ICommand $command the command reference
@param array    $args    command line args

@throws CommandException
Processes the command line arguments and sets the option values for the command .