| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | 7 | public function validate(array $data): ConstraintViolationListInterface |
|
| 38 | { |
||
| 39 | 7 | $validator = Validation::createValidator(); |
|
| 40 | |||
| 41 | 7 | $constraint = new Assert\Collection([ |
|
| 42 | 7 | 'title' => new Assert\NotNull(['message' => 'validator.title.not_null']), |
|
| 43 | 7 | 'name' => new Assert\All([ |
|
| 44 | 7 | new Assert\NotNull(['message' => 'validator.name.not_null']), |
|
| 45 | ]), |
||
| 46 | 7 | 'content' => new Assert\All([ |
|
| 47 | 7 | new Assert\NotBlank(['message' => 'validator.content.not_blank']), |
|
| 48 | ]), |
||
| 49 | ]); |
||
| 50 | |||
| 51 | 7 | return $validator->validate($data, $constraint); |
|
| 52 | } |
||
| 53 | } |
||
| 54 |