CRLFAtTheEnd example

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();
    }

    private function performDomainStartChecks(): Result
    {
        $invalidTokens = $this->checkInvalidTokensAfterAT();
        if ($invalidTokens->isInvalid()) {
            return $invalidTokens;
        }

        

        if (!$this->lexer->current->isA(EmailLexer::CRLF)) {
            return new ValidEmail();
        }

        if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB))) {
            return new InvalidEmail(new CRLFX2()$this->lexer->current->value);
        }

        //this has no coverage. Condition is repeated from above one         if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB))) {
            return new InvalidEmail(new CRLFAtTheEnd()$this->lexer->current->value);
        }

        return new ValidEmail();
    }

    protected function isFWS(): bool
    {
        if ($this->escaped()) {
            return false;
        }

        
Home | Imprint | This part of the site doesn't use cookies.