Total Complexity | 4 |
Total Lines | 21 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
12 | final class Command |
||
13 | { |
||
14 | private $value; |
||
15 | |||
16 | 8 | public function __construct(string $value) |
|
17 | { |
||
18 | 8 | if (empty($value)) { |
|
19 | 2 | throw new EmptyCommandNotAllowed; |
|
20 | } |
||
21 | |||
22 | 6 | $this->value = $value; |
|
23 | 6 | } |
|
24 | |||
25 | 2 | public function matches(RegExp $pattern): bool |
|
26 | { |
||
27 | 2 | return $pattern->matches(Str::of($this->value)); |
|
28 | } |
||
29 | |||
30 | 2 | public function __toString(): string |
|
33 | } |
||
34 | } |
||
35 |