Code Duplication    Length = 3-3 lines in 8 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/DomainLiteral.php 2 locations

@@ 30-32 (lines=3) @@
27
        $IPv6TAG = false;
28
        $addressLiteral = '';
29
        do {
30
            if ($this->lexer->token['type'] === EmailLexer::C_NUL) {
31
                return new InvalidEmail(new ExpectingDTEXT(), $this->lexer->token['value']);
32
            }
33
34
            $this->addObsoleteWarnings();
35
@@ 47-49 (lines=3) @@
44
                $this->parseFWS();
45
            }
46
47
            if ($this->lexer->isNextToken(EmailLexer::S_CR)) {
48
                return new InvalidEmail(new CRNoLF(), $this->lexer->token['value']);
49
            }
50
51
            if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH) {
52
                $this->warnings[ObsoleteDTEXT::CODE] = new ObsoleteDTEXT();

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