| Total Complexity | 6 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | final class Result |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var ErrorMessage[] |
||
| 11 | */ |
||
| 12 | private array $errors = []; |
||
| 13 | |||
| 14 | 140 | public function isValid(): bool |
|
| 17 | } |
||
| 18 | |||
| 19 | 123 | public function addError(ErrorMessage $error): void |
|
| 22 | 123 | } |
|
| 23 | |||
| 24 | 18 | public function addResult(self $result): void |
|
| 27 | 18 | } |
|
| 28 | |||
| 29 | 2 | public function addResultWithErrorMessageWrapper(self $result, ErrorMessage $errorMessage): void |
|
| 30 | { |
||
| 31 | 2 | foreach ($result->errors as $error) { |
|
| 32 | 2 | $this->errors[] = new ErrorMessage( |
|
| 33 | 2 | $errorMessage->getMessage(), |
|
| 34 | 2 | array_merge(['error' => $error], $errorMessage->getParameters()) |
|
| 35 | ); |
||
| 36 | } |
||
| 37 | 2 | } |
|
| 38 | |||
| 39 | /** |
||
| 40 | * @param ErrorMessageFormatterInterface|null $formatter |
||
| 41 | * |
||
| 42 | * @return string[] |
||
| 43 | */ |
||
| 44 | 32 | public function getErrors(?ErrorMessageFormatterInterface $formatter = null): array |
|
| 51 | ); |
||
| 52 | } |
||
| 54 |