Tester\Runner\CommandLine::__construct PHP Method

__construct() public method

public __construct ( $help, array $defaults = [] )
$defaults array
    public function __construct($help, array $defaults = [])
    {
        $this->help = $help;
        $this->options = $defaults;
        preg_match_all('#^[ \\t]+(--?\\w.*?)(?:  .*\\(default: (.*)\\)|  |\\r|$)#m', $help, $lines, PREG_SET_ORDER);
        foreach ($lines as $line) {
            preg_match_all('#(--?\\w[\\w-]*)(?:[= ](<.*?>|\\[.*?]|\\w+)(\\.{0,3}))?[ ,|]*#A', $line[1], $m);
            if (!count($m[0]) || count($m[0]) > 2 || implode('', $m[0]) !== $line[1]) {
                throw new \InvalidArgumentException("Unable to parse '{$line['1']}'.");
            }
            $name = end($m[1]);
            $opts = isset($this->options[$name]) ? $this->options[$name] : [];
            $this->options[$name] = $opts + [self::ARGUMENT => (bool) end($m[2]), self::OPTIONAL => isset($line[2]) || substr(end($m[2]), 0, 1) === '[' || isset($opts[self::VALUE]), self::REPEATABLE => (bool) end($m[3]), self::ENUM => count($enums = explode('|', trim(end($m[2]), '<[]>'))) > 1 ? $enums : NULL, self::VALUE => isset($line[2]) ? $line[2] : NULL];
            if ($name !== $m[1][0]) {
                $this->aliases[$m[1][0]] = $name;
            }
        }
        foreach ($this->options as $name => $foo) {
            if ($name[0] !== '-') {
                $this->positional[] = $name;
            }
        }
    }