DomainTooLong example

$end = $this->checkEndOfDomain();
        if ($end->isInvalid()) {
            return $end;
        }

        $this->lexer->stopRecording();
        $this->domainPart = $this->lexer->getAccumulatedValues();

        $length = strlen($this->domainPart);
        if ($length > self::DOMAIN_MAX_LENGTH) {
            return new InvalidEmail(new DomainTooLong()$this->lexer->current->value);
        }

        return new ValidEmail();
    }

    private function checkEndOfDomain(): Result
    {
        $prev = $this->lexer->getPrevious();
        if ($prev->isA(EmailLexer::S_DOT)) {
            return new InvalidEmail(new DotAtEnd()$this->lexer->current->value);
        }
        
Home | Imprint | This part of the site doesn't use cookies.