| @@ 70-82 (lines=13) @@ | ||
| 67 | ||
| 68 | return; |
|
| 69 | } |
|
| 70 | } else { |
|
| 71 | ||
| 72 | $validator = new NoRFCEmailValidator(); |
|
| 73 | ||
| 74 | if (!$validator->isValid($value)) { |
|
| 75 | $this->context->buildViolation($constraint->message) |
|
| 76 | ->setParameter('{{ value }}', $this->formatValue($value)) |
|
| 77 | ->setCode(Email::INVALID_FORMAT_ERROR) |
|
| 78 | ->addViolation(); |
|
| 79 | ||
| 80 | return; |
|
| 81 | } |
|
| 82 | } |
|
| 83 | ||
| 84 | $host = (string)substr($value, strrpos($value, '@') + 1); |
|
| 85 | ||
| @@ 87-96 (lines=10) @@ | ||
| 84 | $host = (string)substr($value, strrpos($value, '@') + 1); |
|
| 85 | ||
| 86 | // Check for host DNS resource records |
|
| 87 | if ($constraint->checkMX) { |
|
| 88 | if (!$this->checkMX($host)) { |
|
| 89 | $this->context->buildViolation($constraint->message) |
|
| 90 | ->setParameter('{{ value }}', $this->formatValue($value)) |
|
| 91 | ->setCode(Email::MX_CHECK_FAILED_ERROR) |
|
| 92 | ->addViolation(); |
|
| 93 | } |
|
| 94 | ||
| 95 | return; |
|
| 96 | } |
|
| 97 | ||
| 98 | if ($constraint->checkHost && !$this->checkHost($host)) { |
|
| 99 | $this->context->buildViolation($constraint->message) |
|
| @@ 98-103 (lines=6) @@ | ||
| 95 | return; |
|
| 96 | } |
|
| 97 | ||
| 98 | if ($constraint->checkHost && !$this->checkHost($host)) { |
|
| 99 | $this->context->buildViolation($constraint->message) |
|
| 100 | ->setParameter('{{ value }}', $this->formatValue($value)) |
|
| 101 | ->setCode(Email::HOST_CHECK_FAILED_ERROR) |
|
| 102 | ->addViolation(); |
|
| 103 | } |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|