public static function getOption( Command $command, $longCode )
    {
        foreach ( $command->options as $op )
        {
            if ( '--' === substr( $longCode, 0, 2 ) )
            {
                $longCode = substr( $longCode, 2 );
            }
            elseif ( '-' === substr( $longCode, 0, 1 ) )
            {
                $longCode = substr( $longCode, 1 );
            }

            if ( $op->shortCode === $longCode || $op->longCode === $longCode )
            {
                return $op;
            }
        }

        throw new CommandException( 'Unable to find option: ' . $longCode );
    }
public static function getOption( Command $command, $longCode )
    {
        foreach ( $command->options as $op )
        {
            if ( '--' === substr( $longCode, 0, 2 ) )
            {
                $longCode = substr( $longCode, 2 );
            }
            elseif ( '-' === substr( $longCode, 0, 1 ) )
            {
                $longCode = substr( $longCode, 1 );
            }

            if ( $op->shortCode === $longCode || $op->longCode === $longCode )
            {
                return $op;
            }
        }

        throw new CommandException( 'Unable to find option: ' . $longCode );
    }
public static function getOption ( Command $ command , $ longCode ) { foreach ( $ command -> options as $ op ) { if ( '--' === substr ( $ longCode , 0 , 2 ) ) { $ longCode = substr ( $ longCode , 2 ) ; } elseif ( '-' === substr ( $ longCode , 0 , 1 ) ) { $ longCode = substr ( $ longCode , 1 ) ; } if ( $ op -> shortCode === $ longCode || $ op -> longCode === $ longCode ) { return $ op ; } } throw new CommandException ( 'Unable to find option: ' . $ longCode ) ; }
Gets an option either by short or long code.

@param Command $command  the command
@param string  $longCode the command name (code)

@return Option the option

@throws CommandException if option is not found
Gets an option either by short or long code .