Conditions | 3 |
Paths | 3 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | 7 | public function select(string $option): void |
|
18 | { |
||
19 | 7 | if (empty(array_intersect($this->options, [$option]))) { |
|
20 | 1 | throw new UnknownOption($option); |
|
21 | } |
||
22 | |||
23 | 6 | if ($this->isSelected($option)) { |
|
24 | 1 | $this->selections = array_values(array_diff($this->selections, [$option])); |
|
25 | } else { |
||
26 | 6 | $this->selections[] = $option; |
|
27 | } |
||
30 |