You are here

protected function Parser::parseFWS in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/egulias/email-validator/src/Egulias/EmailValidator/Parser/Parser.php \Egulias\EmailValidator\Parser\Parser::parseFWS()
3 calls to Parser::parseFWS()
DomainPart::doParseDomainLiteral in vendor/egulias/email-validator/src/Egulias/EmailValidator/Parser/DomainPart.php
DomainPart::doParseDomainPart in vendor/egulias/email-validator/src/Egulias/EmailValidator/Parser/DomainPart.php
LocalPart::parse in vendor/egulias/email-validator/src/Egulias/EmailValidator/Parser/LocalPart.php

File

vendor/egulias/email-validator/src/Egulias/EmailValidator/Parser/Parser.php, line 71

Class

Parser

Namespace

Egulias\EmailValidator\Parser

Code

protected function parseFWS() {
  $previous = $this->lexer
    ->getPrevious();
  $this
    ->checkCRLFInFWS();
  if ($this->lexer->token['type'] === EmailLexer::S_CR) {
    throw new \InvalidArgumentException("ERR_CR_NO_LF");
  }
  if ($this->lexer
    ->isNextToken(EmailLexer::GENERIC) && $previous['type'] !== EmailLexer::S_AT) {
    throw new \InvalidArgumentException("ERR_ATEXT_AFTER_CFWS");
  }
  if ($this->lexer->token['type'] === EmailLexer::S_LF || $this->lexer->token['type'] === EmailLexer::C_NUL) {
    throw new \InvalidArgumentException('ERR_EXPECTING_CTEXT');
  }
  if ($this->lexer
    ->isNextToken(EmailLexer::S_AT) || $previous['type'] === EmailLexer::S_AT) {
    $this->warnings[] = EmailValidator::DEPREC_CFWS_NEAR_AT;
  }
  else {
    $this->warnings[] = EmailValidator::CFWS_FWS;
  }
}