Total Complexity | 3 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
6 | class ValidationResult |
||
7 | { |
||
8 | /** @var string[] */ |
||
9 | private array $errors = []; |
||
10 | |||
11 | 1 | public function addError(string $error): self |
|
12 | { |
||
13 | 1 | $this->errors[] = $error; |
|
14 | |||
15 | 1 | return $this; |
|
16 | } |
||
17 | |||
18 | 1 | public function passes(): bool |
|
19 | { |
||
20 | 1 | return count($this->errors) === 0; |
|
21 | } |
||
22 | |||
23 | /** |
||
24 | * @return string[] |
||
25 | */ |
||
26 | 1 | public function getErrors(): array |
|
29 | } |
||
30 | } |
||
31 |