1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | namespace NxSys\Library\Clients\Brex\API\Transactions\Runtime\Normalizer; |
12: | |
13: | use Symfony\Component\Validator\Constraint; |
14: | |
15: | trait ValidatorTrait |
16: | { |
17: | protected function validate(array $data, Constraint $constraint): void |
18: | { |
19: | $validator = \Symfony\Component\Validator\Validation::createValidator(); |
20: | $violations = $validator->validate($data, $constraint); |
21: | if ($violations->count() > 0) { |
22: | throw new ValidationException($violations); |
23: | } |
24: | } |
25: | } |
26: | |