| Total Complexity | 5 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 6 | class ValidationResult implements Result |
||
| 7 | { |
||
| 8 | /** @var string[] */ |
||
| 9 | private array $errors = []; |
||
| 10 | |||
| 11 | public static function everythingIsOk(): self |
||
| 14 | } |
||
| 15 | |||
| 16 | public static function withErrors(string ...$error): self |
||
| 21 | } |
||
| 22 | |||
| 23 | public function error(string ...$errors): self |
||
| 24 | { |
||
| 25 | $instance = clone $this; |
||
| 26 | array_push($instance->errors, ...$errors); |
||
| 27 | return $instance; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @inheritDoc |
||
| 32 | */ |
||
| 33 | public function isOk(): bool |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @inheritDoc |
||
| 40 | */ |
||
| 41 | public function getErrors(): array |
||
| 46 |