Total Complexity | 15 |
Total Lines | 63 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
6 | class ArgParser |
||
7 | { |
||
8 | protected $args; |
||
9 | |||
10 | public function __construct(array $args) |
||
11 | { |
||
12 | $this->args = $args; |
||
13 | } |
||
14 | |||
15 | /** |
||
16 | * @throws ArgumentNotFound |
||
17 | */ |
||
18 | public function getArg(string $name): string |
||
19 | { |
||
20 | if (is_numeric($name)) { |
||
21 | $name = (int) $name; |
||
22 | return $this->numericArg($name); |
||
23 | } |
||
24 | |||
25 | return $this->letterArg($name); |
||
26 | } |
||
27 | |||
28 | protected function numericArg(int $position): string |
||
37 | } |
||
38 | |||
39 | protected function letterArg($name): string |
||
51 | } |
||
52 | |||
53 | protected function splitArg(string $arg): array |
||
61 | } |
||
62 | |||
63 | protected function getAdjustedArg(string $name): string |
||
69 | } |
||
70 | } |
||
71 |