| Conditions | 5 |
| Paths | 5 |
| Total Lines | 39 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 15 | 33 | public static function toString( |
|
| 16 | InputInterface $input, |
||
| 17 | InputOption $option |
||
| 18 | ): string { |
||
| 19 | 33 | $name = $option->getName(); |
|
| 20 | |||
| 21 | 33 | if (!$option->acceptValue()) { |
|
| 22 | 5 | return \sprintf( |
|
| 23 | 5 | '--%s', |
|
| 24 | $name |
||
| 25 | ); |
||
| 26 | } |
||
| 27 | |||
| 28 | 28 | if (!$option->isArray()) { |
|
| 29 | 16 | return self::generatePartialOption( |
|
| 30 | $option, |
||
| 31 | $name, |
||
| 32 | 16 | $input->getOption($name) |
|
| 33 | ); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** @var string[] $outputs */ |
||
| 37 | 12 | $outputs = []; |
|
| 38 | 12 | foreach ($input->getOption($name) as $value) { |
|
| 39 | 12 | $value = self::generatePartialOption( |
|
| 40 | $option, |
||
| 41 | $name, |
||
| 42 | $value |
||
| 43 | ); |
||
| 44 | |||
| 45 | 12 | if ($value === '') { |
|
| 46 | 4 | continue; |
|
| 47 | } |
||
| 48 | |||
| 49 | 9 | $outputs[] = $value; |
|
| 50 | } |
||
| 51 | |||
| 52 | 12 | return \implode(' ', $outputs); |
|
| 53 | } |
||
| 54 | |||
| 81 |