| Total Complexity | 5 |
| Total Lines | 35 |
| 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 withError(string ...$error): self |
||
| 17 | { |
||
| 18 | return (new self)->error(...$error); |
||
| 19 | } |
||
| 20 | |||
| 21 | public function error(string ...$errors): self |
||
| 22 | { |
||
| 23 | array_push($this->errors, ...$errors); |
||
| 24 | return $this; |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @inheritDoc |
||
| 29 | */ |
||
| 30 | public function isOk(): bool |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @inheritDoc |
||
| 37 | */ |
||
| 38 | public function getErrors(): array |
||
| 43 |