Lines
100.00%
3 / 3
Methods
100.00%
3 / 3
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| isOk | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| addError | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| getErrors | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| 7 | class ValidationResult | |
| 8 | { | |
| 9 | /** | |
| 10 | * @var string[] | |
| 11 | */ | |
| 12 | private array $errors = []; | |
| 13 | ||
| 14 | public function isOk(): bool | |
| 15 | { | |
| 16 | return count($this->errors) === 0; | |
| 17 | } | |
| 18 | ||
| 19 | public function addError(string $error): void | |
| 20 | { | |
| 21 | $this->errors[] = $error; | |
| 22 | } | |
| 23 | ||
| 24 | /** | |
| 25 | * @return string[] | |
| 26 | */ | |
| 27 | public function getErrors(): array | |
| 28 | { | |
| 29 | return $this->errors; | |
| 30 | } | |
| 31 | } |