Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DomainPart.php

function DomainPart::checkEndOfDomain

1 call to DomainPart::checkEndOfDomain()
DomainPart::parse in vendor/egulias/email-validator/src/Parser/DomainPart.php

File

vendor/egulias/email-validator/src/Parser/DomainPart.php, line 78

Class

DomainPart

Namespace

Egulias\EmailValidator\Parser

Code

private function checkEndOfDomain() : Result {
    $prev = $this->lexer
        ->getPrevious();
    if ($prev->isA(EmailLexer::S_DOT)) {
        return new InvalidEmail(new DotAtEnd(), $this->lexer->current->value);
    }
    if ($prev->isA(EmailLexer::S_HYPHEN)) {
        return new InvalidEmail(new DomainHyphened('Hypen found at the end of the domain'), $prev->value);
    }
    if ($this->lexer->current
        ->isA(EmailLexer::S_SP)) {
        return new InvalidEmail(new CRLFAtTheEnd(), $prev->value);
    }
    return new ValidEmail();
}
RSS feed
Powered by Drupal