| Conditions | 5 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 15 | public function validate($value, Constraint $constraint): void |
||
| 16 | { |
||
| 17 | if (!$constraint instanceof ValidCreditorReference) { |
||
| 18 | throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\ValidCreditorReference'); |
||
| 19 | } |
||
| 20 | |||
| 21 | if (null === $value || '' === $value) { |
||
| 22 | return; |
||
| 23 | } |
||
| 24 | |||
| 25 | $referenceGenerator = new phpIso11649(); |
||
| 26 | |||
| 27 | if (false === $referenceGenerator->validateRfReference($value)) { |
||
| 28 | $this->context->buildViolation($constraint->message) |
||
| 29 | ->setParameter('{{ string }}', $value) |
||
| 30 | ->addViolation(); |
||
| 31 | } |
||
| 34 |