Mercurial > hg > cmmr2012-drupal-site
comparison core/lib/Drupal/Component/Utility/EmailValidator.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Component\Utility; | |
4 | |
5 use Egulias\EmailValidator\EmailValidator as EmailValidatorUtility; | |
6 use Egulias\EmailValidator\Validation\EmailValidation; | |
7 use Egulias\EmailValidator\Validation\RFCValidation; | |
8 | |
9 /** | |
10 * Validates email addresses. | |
11 */ | |
12 class EmailValidator extends EmailValidatorUtility implements EmailValidatorInterface { | |
13 | |
14 /** | |
15 * Validates an email address. | |
16 * | |
17 * @param string $email | |
18 * A string containing an email address. | |
19 * @param \Egulias\EmailValidator\Validation\EmailValidation|null $email_validation | |
20 * This argument is ignored. If it is supplied an error will be triggered. | |
21 * See https://www.drupal.org/node/2997196. | |
22 * | |
23 * @return bool | |
24 * TRUE if the address is valid. | |
25 */ | |
26 public function isValid($email, EmailValidation $email_validation = NULL) { | |
27 if ($email_validation) { | |
28 throw new \BadMethodCallException('Calling \Drupal\Component\Utility\EmailValidator::isValid() with the second argument is not supported. See https://www.drupal.org/node/2997196'); | |
29 } | |
30 return parent::isValid($email, (new RFCValidation())); | |
31 } | |
32 | |
33 } |