public function normalizeOptions(array $options = array(), array $switchOptions = array(), $valueOptions = array())
    {
        $normalizedOptions = array();

        foreach ($options as $option) {
            if (array_key_exists($option, $switchOptions)) {
                $normalizedOptions[$switchOptions[$option]] = $switchOptions[$option];
            } else {
                $parts = preg_split('/([\s=])+/', $option, 2, PREG_SPLIT_DELIM_CAPTURE);
                if (count($parts)) {
                    $optionName = $parts[0];
                    if (in_array($optionName, $valueOptions)) {
                        $value = ($parts[1] == '=') ? $option : array($parts[0], $parts[2]);
                        $normalizedOptions[$optionName] = $value;
                    }
                }
            }
        }

        return $normalizedOptions;
    }
public function normalizeOptions(array $options = array(), array $switchOptions = array(), $valueOptions = array())
    {
        $normalizedOptions = array();

        foreach ($options as $option) {
            if (array_key_exists($option, $switchOptions)) {
                $normalizedOptions[$switchOptions[$option]] = $switchOptions[$option];
            } else {
                $parts = preg_split('/([\s=])+/', $option, 2, PREG_SPLIT_DELIM_CAPTURE);
                if (count($parts)) {
                    $optionName = $parts[0];
                    if (in_array($optionName, $valueOptions)) {
                        $value = ($parts[1] == '=') ? $option : array($parts[0], $parts[2]);
                        $normalizedOptions[$optionName] = $value;
                    }
                }
            }
        }

        return $normalizedOptions;
    }
public function normalizeOptions ( array $ options = array ( ) , array $ switchOptions = array ( ) , $ valueOptions = array ( ) ) { $ normalizedOptions = array ( ) ; foreach ( $ options as $ option ) { if ( array_key_exists ( $ option , $ switchOptions ) ) { $ normalizedOptions [ $ switchOptions [ $ option ] ] = $ switchOptions [ $ option ] ; } else { $ parts = preg_split ( '/([\s=])+/' , $ option , 2 , PREG_SPLIT_DELIM_CAPTURE ) ; if ( count ( $ parts ) ) { $ optionName = $ parts [ 0 ] ; if ( in_array ( $ optionName , $ valueOptions ) ) { $ value = ( $ parts [ 1 ] == '=' ) ? $ option : array ( $ parts [ 0 ] , $ parts [ 2 ] ) ; $ normalizedOptions [ $ optionName ] = $ value ; } } } } return $ normalizedOptions ; }
Normalize any valid option to its long name
an provide a structure that can be more intelligently
handled by other routines

@param array $options       command options
@param array $switchOptions list of valid options that are switch like
@param array $valueOptions  list of valid options that must have a value assignment

@return array Associative array of valid, normalized command options
Normalize any valid option to its long name an provide a structure that can be more intelligently handled by other routines