You are here

protected function Parser::checkDQUOTE 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::checkDQUOTE()
2 calls to Parser::checkDQUOTE()
LocalPart::parse in vendor/egulias/email-validator/src/Egulias/EmailValidator/Parser/LocalPart.php
LocalPart::parseDoubleQuote in vendor/egulias/email-validator/src/Egulias/EmailValidator/Parser/LocalPart.php

File

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

Class

Parser

Namespace

Egulias\EmailValidator\Parser

Code

protected function checkDQUOTE($hasClosingQuote) {
  if ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE) {
    return $hasClosingQuote;
  }
  if ($hasClosingQuote) {
    return $hasClosingQuote;
  }
  $previous = $this->lexer
    ->getPrevious();
  if ($this->lexer
    ->isNextToken(EmailLexer::GENERIC) && $previous['type'] === EmailLexer::GENERIC) {
    throw new \InvalidArgumentException('ERR_EXPECTING_ATEXT');
  }
  $this->warnings[] = EmailValidator::RFC5321_QUOTEDSTRING;
  try {
    $this->lexer
      ->find(EmailLexer::S_DQUOTE);
    $hasClosingQuote = true;
  } catch (\Exception $e) {
    throw new \InvalidArgumentException('ERR_UNCLOSEDQUOTEDSTR');
  }
  return $hasClosingQuote;
}