Conditions | 7 |
Paths | 4 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
38 | public function validate($value, Constraint $constraint) |
||
39 | { |
||
40 | if (null === $value || '' === $value) { |
||
41 | return; |
||
42 | } |
||
43 | |||
44 | if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { |
||
45 | throw new UnexpectedTypeException($value, 'string'); |
||
46 | } |
||
47 | |||
48 | if (!$this->emailChecker->isValid($value)) { |
||
49 | $this->context->addViolation($constraint->message); |
||
50 | } |
||
51 | } |
||
52 | } |
||
53 |