[ Index ]

MailPress 7.2

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/composer/vendor/egulias/email-validator/EmailValidator/Validation/ -> SpoofCheckValidation.php (source)

   1  <?php
   2  
   3  namespace Egulias\EmailValidator\Validation;
   4  
   5  use Egulias\EmailValidator\EmailLexer;
   6  use Egulias\EmailValidator\Exception\InvalidEmail;
   7  use Egulias\EmailValidator\Validation\Error\SpoofEmail;
   8  use \Spoofchecker;
   9  
  10  class SpoofCheckValidation implements EmailValidation
  11  {
  12      /**
  13       * @var InvalidEmail
  14       */
  15      private $error;
  16  
  17      public function __construct()
  18      {
  19          if (!extension_loaded('intl')) {
  20              throw new \LogicException(sprintf('The %s class requires the Intl extension.', __CLASS__));
  21          }
  22      }
  23  
  24      public function isValid($email, EmailLexer $emailLexer)
  25      {
  26          $checker = new Spoofchecker();
  27          $checker->setChecks(Spoofchecker::SINGLE_SCRIPT);
  28  
  29          if ($checker->isSuspicious($email)) {
  30              $this->error = new SpoofEmail();
  31          }
  32  
  33          return $this->error === null;
  34      }
  35  
  36      public function getError()
  37      {
  38          return $this->error;
  39      }
  40  
  41      public function getWarnings()
  42      {
  43          return [];
  44      }
  45  }


Generated: Tue May 19 15:55:14 2020 Cross-referenced by PHPXref 0.7.1