Code Duplication    Length = 3-3 lines in 7 locations

EmailValidator/Parser/Comment.php 2 locations

@@ 36-38 (lines=3) @@
33
            }
34
        }
35
36
        if ($this->lexer->token['type'] === EmailLexer::S_CLOSEPARENTHESIS) {
37
            return new InvalidEmail(new UnOpenedComment(), $this->lexer->token['value']);
38
        }
39
40
        $this->warnings[WarningComment::CODE] = new WarningComment();
41
@@ 57-59 (lines=3) @@
54
55
        if($this->openedParenthesis >= 1) {
56
            return new InvalidEmail(new UnclosedComment(), $this->lexer->token['value']);
57
        } else if ($this->openedParenthesis < 0) {
58
            return new InvalidEmail(new UnOpenedComment(), $this->lexer->token['value']);
59
        }
60
61
        $finalValidations = $this->commentStrategy->endOfLoopValidations($this->lexer);
62

EmailValidator/Parser/FoldingWhiteSpace.php 1 location

@@ 27-29 (lines=3) @@
24
25
        $this->checkCRLFInFWS();
26
27
        if ($this->lexer->token['type'] === EmailLexer::S_CR) {
28
            return new InvalidEmail(new CRNoLF(), $this->lexer->token['value']);
29
        }
30
31
        if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type']  !== EmailLexer::S_AT) {
32
            return new InvalidEmail(new AtextAfterCFWS(), $this->lexer->token['value']);

EmailValidator/Parser/DomainPart.php 3 locations

@@ 97-99 (lines=3) @@
94
95
    private function checkInvalidTokensAfterAT() : Result
96
    {
97
        if ($this->lexer->token['type'] === EmailLexer::S_DOT) {
98
            return new InvalidEmail(new DotAtStart(), $this->lexer->token['value']);
99
        }
100
        if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN) {
101
            return new InvalidEmail(new ReasonDomainHyphened('After AT'), $this->lexer->token['value']);
102
        }
@@ 100-102 (lines=3) @@
97
        if ($this->lexer->token['type'] === EmailLexer::S_DOT) {
98
            return new InvalidEmail(new DotAtStart(), $this->lexer->token['value']);
99
        }
100
        if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN) {
101
            return new InvalidEmail(new ReasonDomainHyphened('After AT'), $this->lexer->token['value']);
102
        }
103
        return new ValidEmail();
104
    }
105
@@ 227-229 (lines=3) @@
224
            throw new CommaInDomain();
225
        }
226
227
        if ($this->lexer->token['type'] === EmailLexer::S_AT) {
228
            return new InvalidEmail(new ReasonConsecutiveAt(), $this->lexer->token['value']);
229
        }
230
231
        if ($this->lexer->token['type'] === EmailLexer::S_OPENQBRACKET && $prev['type'] !== EmailLexer::S_AT) {
232
            throw new ExpectingATEXT();

EmailValidator/Parser/DomainLiteral.php 1 location

@@ 48-50 (lines=3) @@
45
                $this->parseFWS();
46
            }
47
48
            if ($this->lexer->isNextToken(EmailLexer::S_CR)) {
49
                return new InvalidEmail(new CRNoLF(), $this->lexer->token['value']);
50
            }
51
52
            if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH) {
53
                $this->warnings[ObsoleteDTEXT::CODE] = new ObsoleteDTEXT();