1 | <?php declare(strict_types=1); |
||
11 | final class ValidationResult implements ValidationResultInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | private array $errors = []; |
||
|
|||
17 | |||
18 | /** |
||
19 | * @param ConstraintViolationListInterface $constraintViolationList |
||
20 | */ |
||
21 | 4 | public function __construct(ConstraintViolationListInterface $constraintViolationList) |
|
22 | { |
||
23 | /** @var ConstraintViolationInterface $violation */ |
||
24 | 4 | foreach ($constraintViolationList as $violation) { |
|
25 | 4 | $this->errors[$violation->getPropertyPath()] = [ |
|
26 | 4 | 'message' => $violation->getMessageTemplate(), |
|
27 | 4 | 'parameters' => $violation->getParameters(), |
|
28 | ]; |
||
29 | } |
||
30 | 4 | } |
|
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | 4 | public function getErrors(): array |
|
36 | { |
||
37 | 4 | return $this->errors; |
|
38 | } |
||
39 | } |
||
40 |