[ Index ]

MailPress 7.2

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

title

Body

[close]

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

   1  <?php
   2  
   3  namespace Egulias\EmailValidator\Validation;
   4  
   5  use Egulias\EmailValidator\EmailLexer;
   6  use Egulias\EmailValidator\EmailParser;
   7  use Egulias\EmailValidator\Exception\InvalidEmail;
   8  
   9  class RFCValidation implements EmailValidation
  10  {
  11      /**
  12       * @var EmailParser
  13       */
  14      private $parser;
  15  
  16      /**
  17       * @var array
  18       */
  19      private $warnings = [];
  20  
  21      /**
  22       * @var InvalidEmail
  23       */
  24      private $error;
  25  
  26      public function isValid($email, EmailLexer $emailLexer)
  27      {
  28          $this->parser = new EmailParser($emailLexer);
  29          try {
  30              $this->parser->parse((string)$email);
  31          } catch (InvalidEmail $invalid) {
  32              $this->error = $invalid;
  33              return false;
  34          }
  35  
  36          $this->warnings = $this->parser->getWarnings();
  37          return true;
  38      }
  39  
  40      public function getError()
  41      {
  42          return $this->error;
  43      }
  44  
  45      public function getWarnings()
  46      {
  47          return $this->warnings;
  48      }
  49  }


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