1 | <?php |
||
7 | class Arguments |
||
8 | { |
||
9 | /** @var string */ |
||
10 | protected $filterArgument; |
||
11 | protected $phpUnitOptions = []; |
||
12 | protected $applicationOptions = []; |
||
13 | |||
14 | public static function fromString(string $argumentsInput) |
||
18 | |||
19 | public function setFilterArgument($filterArgument) |
||
20 | { |
||
21 | $this->filterArgument = $filterArgument; |
||
22 | |||
23 | return $this; |
||
24 | } |
||
25 | |||
26 | public function setFilter($query) |
||
32 | |||
33 | /** |
||
34 | * Parses a raw arguments string. |
||
35 | * |
||
36 | * The following types of arguments will be parsed: space separated arguments, key/value and boolean arguments, |
||
37 | * and test file name arguments. Space separated arguments are key/value arguments separated by a space. Boolean |
||
38 | * and key/value arguments are regular options that either take no parameters or take a =-separated parameter. |
||
39 | * Test file name arguments are file names (without option flags). |
||
40 | * |
||
41 | * @param $argumentsInput |
||
42 | * @return $this |
||
43 | */ |
||
44 | protected function parse(string $argumentsInput) |
||
79 | |||
80 | /* |
||
81 | * Adds an argument if it does not yet exist, otherwise the argument value is replaced. |
||
82 | * |
||
83 | * In case $value is left empty, the argument will be treated as a boolean option. If the |
||
84 | * name and value are not separated by a space, pass the correct separator as a third |
||
85 | * parameter. |
||
86 | * |
||
87 | * Unless an option is registered (in this class) as an application option, we will assume |
||
88 | * the option is meant to be passed through to PHPUnit. |
||
89 | */ |
||
90 | public function addArgument(string $name, string $value = null, string $separator = '=') |
||
102 | |||
103 | public function phpUnitArguments(): string |
||
117 | |||
118 | public function toArray(): array |
||
128 | |||
129 | protected function parseOption(string $argument) |
||
141 | |||
142 | protected function optionName(string $argument): string |
||
158 | |||
159 | protected function isOption(string $argument): bool |
||
163 | |||
164 | protected function isApplicationOption(string $option): bool |
||
168 | |||
169 | protected function isOptionWithSpaceSeparatedArgument(string $option): bool |
||
173 | } |
||
174 |