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

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