You are here

protected function DomainPart::doParseDomainPart in Zircon Profile 8

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

File

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

Class

DomainPart

Namespace

Egulias\EmailValidator\Parser

Code

protected function doParseDomainPart() {
  $domain = '';
  do {
    $prev = $this->lexer
      ->getPrevious();
    if ($this->lexer->token['type'] === EmailLexer::S_SLASH) {
      throw new \InvalidArgumentException('ERR_DOMAIN_CHAR_NOT_ALLOWED');
    }
    if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) {
      $this
        ->parseComments();
      $this->lexer
        ->moveNext();
    }
    $this
      ->checkConsecutiveDots();
    $this
      ->checkDomainPartExceptions($prev);
    if ($this
      ->hasBrackets()) {
      $this
        ->parseDomainLiteral();
    }
    $this
      ->checkLabelLength($prev);
    if ($this
      ->isFWS()) {
      $this
        ->parseFWS();
    }
    $domain .= $this->lexer->token['value'];
    $this->lexer
      ->moveNext();
  } while ($this->lexer->token);
  return $domain;
}