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

Breadcrumb

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

function IDRightPart::validateTokens

Overrides DomainPart::validateTokens

File

vendor/egulias/email-validator/src/Parser/IDRightPart.php, line 13

Class

IDRightPart

Namespace

Egulias\EmailValidator\Parser

Code

protected function validateTokens(bool $hasComments) : Result {
    $invalidDomainTokens = [
        EmailLexer::S_DQUOTE => true,
        EmailLexer::S_SQUOTE => true,
        EmailLexer::S_BACKTICK => true,
        EmailLexer::S_SEMICOLON => true,
        EmailLexer::S_GREATERTHAN => true,
        EmailLexer::S_LOWERTHAN => true,
    ];
    if (isset($invalidDomainTokens[$this->lexer->current->type])) {
        return new InvalidEmail(new ExpectingATEXT('Invalid token in domain: ' . $this->lexer->current->value), $this->lexer->current->value);
    }
    return new ValidEmail();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal