| Conditions | 3 |
| Paths | 3 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | public function validate($value, Constraint $constraint): void |
||
| 25 | { |
||
| 26 | if (!$constraint instanceof YoutubeUrl) { |
||
| 27 | throw new UnexpectedTypeException($constraint, YoutubeUrl::class); |
||
| 28 | } |
||
| 29 | |||
| 30 | if (!preg_match(self::YOUTUBE_REGEX_VALIDATOR, (string) $value)) { |
||
| 31 | $this->context->buildViolation($constraint->message) |
||
| 32 | ->setParameter('{{ string }}', $value) |
||
| 33 | ->addViolation() |
||
| 34 | ; |
||
| 38 |