Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
8 / 8 |
|
100.00% |
6 / 6 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
| Opt | |
100.00% |
5 / 5 |
|
100.00% |
8 / 8 |
|
100.00% |
6 / 6 |
|
100.00% |
5 / 5 |
6 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| set | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| get | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| all | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isset | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Celemas\Cli; |
| 6 | |
| 7 | /** |
| 8 | * @api |
| 9 | */ |
| 10 | final class Opt |
| 11 | { |
| 12 | private array $values; |
| 13 | |
| 14 | public function __construct(?string $value = null) |
| 15 | { |
| 16 | $this->values = $value === null ? [] : [$value]; |
| 17 | } |
| 18 | |
| 19 | public function set(string $value): void |
| 20 | { |
| 21 | $this->values[] = $value; |
| 22 | } |
| 23 | |
| 24 | public function get(int $index = 0): string |
| 25 | { |
| 26 | return $this->values[$index]; |
| 27 | } |
| 28 | |
| 29 | public function all(): array |
| 30 | { |
| 31 | return $this->values; |
| 32 | } |
| 33 | |
| 34 | public function isset(): bool |
| 35 | { |
| 36 | return count($this->values) > 0; |
| 37 | } |
| 38 | } |