Code Duplication    Length = 3-4 lines in 3 locations

src/Parser/DoubleQuote.php 2 locations

@@ 61-63 (lines=3) @@
58
            if($validQuotedString->isInvalid()) return $validQuotedString;
59
        }
60
61
        if (!$this->lexer->isNextToken(EmailLexer::S_AT) && $prev['type'] !== EmailLexer::S_BACKSLASH) {
62
            return new InvalidEmail(new ExpectingATEXT("Expecting ATEXT between DQUOTE"), $this->lexer->token['value']);
63
        }
64
65
        return new ValidEmail();
66
    }
@@ 72-75 (lines=4) @@
69
    {
70
        $previous = $this->lexer->getPrevious();
71
72
        if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type'] === EmailLexer::GENERIC) {
73
            $description = 'https://tools.ietf.org/html/rfc5322#section-3.2.4 - quoted string should be a unit';
74
            return new InvalidEmail(new ExpectingATEXT($description), $this->lexer->token['value']);
75
        }
76
77
        try {
78
            $this->lexer->find(EmailLexer::S_DQUOTE);

src/Parser/FoldingWhiteSpace.php 1 location

@@ 35-37 (lines=3) @@
32
            return new InvalidEmail(new CRNoLF(), $this->lexer->token['value']);
33
        }
34
35
        if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type']  !== EmailLexer::S_AT) {
36
            return new InvalidEmail(new AtextAfterCFWS(), $this->lexer->token['value']);
37
        }
38
39
        if ($this->lexer->token['type'] === EmailLexer::S_LF || $this->lexer->token['type'] === EmailLexer::C_NUL) {
40
            return new InvalidEmail(new ExpectingCTEXT(), $this->lexer->token['value']);