function DomainPart::checkDomainPartExceptions
Parameters
Token<int, string> $prev:
bool $hasComments:
Return value
1 call to DomainPart::checkDomainPartExceptions()
- DomainPart::doParseDomainPart in vendor/
egulias/ email-validator/ src/ Parser/ DomainPart.php
File
-
vendor/
egulias/ email-validator/ src/ Parser/ DomainPart.php, line 253
Class
Namespace
Egulias\EmailValidator\ParserCode
protected function checkDomainPartExceptions(Token $prev, bool $hasComments) : Result {
if ($this->lexer->current
->isA(EmailLexer::S_OPENBRACKET) && $prev->type !== EmailLexer::S_AT) {
return new InvalidEmail(new ExpectingATEXT('OPENBRACKET not after AT'), $this->lexer->current->value);
}
if ($this->lexer->current
->isA(EmailLexer::S_HYPHEN) && $this->lexer
->isNextToken(EmailLexer::S_DOT)) {
return new InvalidEmail(new DomainHyphened('Hypen found near DOT'), $this->lexer->current->value);
}
if ($this->lexer->current
->isA(EmailLexer::S_BACKSLASH) && $this->lexer
->isNextToken(EmailLexer::GENERIC)) {
return new InvalidEmail(new ExpectingATEXT('Escaping following "ATOM"'), $this->lexer->current->value);
}
return $this->validateTokens($hasComments);
}