Code Duplication    Length = 3-5 lines in 5 locations

EmailValidator/Parser/FoldingWhiteSpace.php 1 location

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

EmailValidator/Parser/LocalPart.php 2 locations

@@ 59-61 (lines=3) @@
56
                }
57
            }
58
59
            if ($this->lexer->token['type'] === EmailLexer::S_DOT && $this->lexer->isNextToken(EmailLexer::S_DOT)) {
60
                return new InvalidEmail(new ConsecutiveDot(), $this->lexer->token['value']);
61
            }
62
63
            if ($this->lexer->token['type'] === EmailLexer::S_DOT &&
64
                $this->lexer->isNextToken(EmailLexer::S_AT)
@@ 63-67 (lines=5) @@
60
                return new InvalidEmail(new ConsecutiveDot(), $this->lexer->token['value']);
61
            }
62
63
            if ($this->lexer->token['type'] === EmailLexer::S_DOT &&
64
                $this->lexer->isNextToken(EmailLexer::S_AT)
65
            ) {
66
                return new InvalidEmail(new DotAtEnd(), $this->lexer->token['value']);
67
            }
68
69
            $resultEscaping = $this->validateEscaping();
70
            if ($resultEscaping->isInvalid()) {

EmailValidator/Parser/DomainPart.php 1 location

@@ 235-237 (lines=3) @@
232
            throw new ExpectingATEXT();
233
        }
234
235
        if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN && $this->lexer->isNextToken(EmailLexer::S_DOT)) {
236
            return new InvalidEmail(new ReasonDomainHyphened('Hypen found near DOT'), $this->lexer->token['value']);
237
        }
238
239
        if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH
240
            && $this->lexer->isNextToken(EmailLexer::GENERIC)) {

EmailValidator/Parser/Parser.php 1 location

@@ 124-126 (lines=3) @@
121
122
    protected function checkConsecutiveDots()
123
    {
124
        if ($this->lexer->token['type'] === EmailLexer::S_DOT && $this->lexer->isNextToken(EmailLexer::S_DOT)) {
125
            return new InvalidEmail(new ConsecutiveDot(), $this->lexer->token['value']);
126
        }
127
    }
128
129
    /**