| Conditions | 5 | 
| Paths | 4 | 
| Total Lines | 22 | 
| Code Lines | 11 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 20 | public function validate($value, Constraint $constraint): void  | 
            ||
| 21 |     { | 
            ||
| 22 | // custom constraints should ignore null and empty values to allow  | 
            ||
| 23 | // other constraints (NotBlank, NotNull, etc.) take care of that  | 
            ||
| 24 |         if ('' === $value || null === $value) { | 
            ||
| 25 | return;  | 
            ||
| 26 | }  | 
            ||
| 27 | |||
| 28 |         if (!$constraint instanceof Barcode) { | 
            ||
| 29 |             throw new InvalidArgumentException(sprintf('This validator only supports the %s constraint', Barcode::class)); | 
            ||
| 30 | }  | 
            ||
| 31 | |||
| 32 | $validator = new ActualBarcodeValidator($value);  | 
            ||
| 33 | $valid = (bool) $validator->isValid();  | 
            ||
| 34 | |||
| 35 |         if (!$valid) { | 
            ||
| 36 | $this->context->buildViolation($constraint->message)  | 
            ||
| 37 |                 ->setParameter('{{ string }}', $value) | 
            ||
| 38 | ->addViolation();  | 
            ||
| 39 | }  | 
            ||
| 40 | |||
| 41 | unset($validator);  | 
            ||
| 42 | }  | 
            ||
| 44 |