Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
23 | public static function fromViolationList(ConstraintViolationListInterface $list) |
||
24 | { |
||
25 | $errors = []; |
||
26 | foreach ($list as $violation) { |
||
27 | /** @var ConstraintViolationInterface $violation */ |
||
28 | $errors[$violation->getPropertyPath()] = [ |
||
29 | 'message' => $violation->getMessage(), |
||
30 | 'code' => $violation->getCode(), |
||
31 | 'root' => $violation->getRoot(), |
||
32 | 'invalid_value' => $violation->getInvalidValue(), |
||
33 | ]; |
||
34 | } |
||
35 | |||
36 | return new static( |
||
37 | 'Invalid data submitted for entity: ' . PHP_EOL . |
||
38 | Yaml::dump($errors) |
||
39 | ); |
||
40 | } |
||
41 | |||
43 |