1 | <?php |
||
7 | class Arguments |
||
8 | { |
||
9 | use ArgumentAccessors; |
||
10 | |||
11 | const APPLICATION_OPTIONS = []; |
||
12 | |||
13 | /** @var string */ |
||
14 | protected $testFile; |
||
15 | protected $phpUnitOptions = []; |
||
16 | protected $applicationOptions = []; |
||
17 | |||
18 | /** |
||
19 | * Parses the given arguments string and instantiates a new object containing the arguments. |
||
20 | * |
||
21 | * @param string $argumentsInput |
||
22 | * @return $this |
||
23 | */ |
||
24 | public static function fromString($argumentsInput) |
||
28 | |||
29 | /* |
||
30 | * Adds an argument if it does not yet exist, otherwise the argument value is replaced. |
||
31 | * |
||
32 | * In case $value is left empty, the argument will be treated as a boolean option. If the |
||
33 | * name and value are not separated by a space, pass the correct separator as a third |
||
34 | * parameter. |
||
35 | * |
||
36 | * Unless an option is registered (in this class) as an application option, we will assume |
||
37 | * the option is meant to be passed through to PHPUnit. |
||
38 | */ |
||
39 | public function addArgument(string $name, string $value = null, string $separator = '=') |
||
51 | |||
52 | public function phpUnitArguments(): string |
||
67 | |||
68 | public function toArray(): array |
||
78 | |||
79 | /** |
||
80 | * Parses a raw arguments string. |
||
81 | * |
||
82 | * The following types of arguments will be parsed: space separated arguments, key/value and boolean arguments, |
||
83 | * and test file name arguments. Space separated arguments are key/value arguments separated by a space. Boolean |
||
84 | * and key/value arguments are regular options that either take no parameters or take a =-separated parameter. |
||
85 | * Test file name arguments are file names (without option flags). |
||
86 | * |
||
87 | * @param $argumentsInput |
||
88 | * @return $this |
||
89 | */ |
||
90 | protected function parse(string $argumentsInput) |
||
125 | |||
126 | protected function parseOption(string $argument) |
||
138 | |||
139 | protected function optionName(string $argument): string |
||
155 | |||
156 | protected function isOption(string $argument): bool |
||
160 | |||
161 | protected function isApplicationOption(string $option): bool |
||
165 | |||
166 | protected function isOptionWithSpaceSeparatedArgument(string $option): bool |
||
170 | } |
||
171 |