extensions/coverage/coverage_utils.php
public static function parseArguments($argv, $mutliValueMode = false)
    {
        $args                   = array();
        $args['extraArguments'] = array();
        array_shift($argv); // scriptname
        foreach ($argv as $arg) {
            if (preg_match('#^--([^=]+)=(.*)#', $arg, $reg)) {
                $args[$reg[1]] = $reg[2];
                if ($mutliValueMode) {
                    self::addItemAsArray($args, $reg[1], $reg[2]);
                }
            } elseif (preg_match('#^[-]{1,2}([^[:blank:]]+)#', $arg, $reg)) {
                $nonnull       = '';
                $args[$reg[1]] = $nonnull;
                if ($mutliValueMode) {
                    self::addItemAsArray($args, $reg[1], $nonnull);
                }
            } else {
                $args['extraArguments'][] = $arg;
            }
        }

        return $args;
    }
public static function parseArguments($argv, $mutliValueMode = false)
    {
        $args                   = array();
        $args['extraArguments'] = array();
        array_shift($argv); // scriptname
        foreach ($argv as $arg) {
            if (preg_match('#^--([^=]+)=(.*)#', $arg, $reg)) {
                $args[$reg[1]] = $reg[2];
                if ($mutliValueMode) {
                    self::addItemAsArray($args, $reg[1], $reg[2]);
                }
            } elseif (preg_match('#^[-]{1,2}([^[:blank:]]+)#', $arg, $reg)) {
                $nonnull       = '';
                $args[$reg[1]] = $nonnull;
                if ($mutliValueMode) {
                    self::addItemAsArray($args, $reg[1], $nonnull);
                }
            } else {
                $args['extraArguments'][] = $arg;
            }
        }

        return $args;
    }
Parses simple parameters from CLI.

Puts trailing parameters into string array in 'extraArguments'

Example:
$args = CoverageUtil::parseArguments($_SERVER['argv']);
if ($args['verbose']) echo "Verbose Mode On\n";
$files = $args['extraArguments'];

Example CLI:
--foo=blah -x -h  some trailing arguments

if multiValueMode is true
Example CLI:
--include=a --include=b --exclude=c
Then
$args = CoverageUtil::parseArguments($_SERVER['argv']);
$args['include[]'] will equal array('a', 'b')
$args['exclude[]'] will equal array('c')
$args['exclude'] will equal c
$args['include'] will equal b   NOTE: only keeps last value

@param unknown_type $argv
@param supportMutliValue - will store 2nd copy of value in an array with key "foo[]"

@return unknown