Total Complexity | 5 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
8 | final class MaxChannels |
||
9 | { |
||
10 | private $value; |
||
11 | |||
12 | 98 | public function __construct(int $value) |
|
13 | { |
||
14 | 98 | if ($value < 0) { |
|
15 | 2 | throw new DomainException; |
|
16 | } |
||
17 | |||
18 | 96 | $this->value = $value; |
|
19 | 96 | } |
|
20 | |||
21 | 92 | public function allows(int $channel): bool |
|
22 | { |
||
23 | 92 | if ($this->value === 0) { |
|
24 | 92 | return true; |
|
25 | } |
||
26 | |||
27 | 2 | return $channel <= $this->value; |
|
28 | } |
||
29 | |||
30 | 96 | public function toInt(): int |
|
33 | } |
||
34 | } |
||
35 |