1 | <?php |
||
23 | trait ArgumentUserTrait |
||
24 | { |
||
25 | protected string $user; |
||
|
|||
26 | |||
27 | /** |
||
28 | * @param InputInterface $input |
||
29 | * |
||
30 | * @throws InvalidArgumentException |
||
31 | */ |
||
32 | protected function initializeUserArgument(InputInterface $input): void |
||
33 | { |
||
34 | $user = $input->getArgument('user'); |
||
35 | |||
36 | if (!\is_string($user)) { |
||
37 | throw new InvalidArgumentException('Argument "user" is not a string.'); |
||
38 | } |
||
39 | |||
40 | $this->user = $user; |
||
41 | } |
||
42 | } |
||
43 |