Code Duplication    Length = 3-5 lines in 6 locations

src/Parser/DomainPart.php 2 locations

@@ 356-358 (lines=3) @@
353
            throw new ExpectingATEXT();
354
        }
355
356
        if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN && $this->lexer->isNextToken(EmailLexer::S_DOT)) {
357
            throw new DomainHyphened();
358
        }
359
360
        if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH
361
            && $this->lexer->isNextToken(EmailLexer::GENERIC)) {
@@ 360-363 (lines=4) @@
357
            throw new DomainHyphened();
358
        }
359
360
        if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH
361
            && $this->lexer->isNextToken(EmailLexer::GENERIC)) {
362
            throw new ExpectingATEXT();
363
        }
364
    }
365
366
    /**

src/Parser/LocalPart.php 2 locations

@@ 49-53 (lines=5) @@
46
47
            $this->checkConsecutiveDots();
48
49
            if ($this->lexer->token['type'] === EmailLexer::S_DOT &&
50
                $this->lexer->isNextToken(EmailLexer::S_AT)
51
            ) {
52
                throw new DotAtEnd();
53
            }
54
55
            $this->warnEscaping();
56
            $this->isInvalidToken($this->lexer->token, $closingQuote);
@@ 99-101 (lines=3) @@
96
                $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS();
97
                $setSpecialsWarning = false;
98
            }
99
            if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH && $this->lexer->isNextToken(EmailLexer::S_DQUOTE)) {
100
                $this->lexer->moveNext();
101
            }
102
103
            $this->lexer->moveNext();
104

src/Parser/Parser.php 2 locations

@@ 140-142 (lines=3) @@
137
138
    protected function checkConsecutiveDots()
139
    {
140
        if ($this->lexer->token['type'] === EmailLexer::S_DOT && $this->lexer->isNextToken(EmailLexer::S_DOT)) {
141
            throw new ConsecutiveDot();
142
        }
143
    }
144
145
    /**
@@ 220-222 (lines=3) @@
217
            return $hasClosingQuote;
218
        }
219
        $previous = $this->lexer->getPrevious();
220
        if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type'] === EmailLexer::GENERIC) {
221
            throw new ExpectingATEXT();
222
        }
223
224
        try {
225
            $this->lexer->find(EmailLexer::S_DQUOTE);