Code Duplication    Length = 3-5 lines in 6 locations

src/Egulias/EmailValidator/Parser/DomainPart.php 2 locations

@@ 287-289 (lines=3) @@
284
            throw new \InvalidArgumentException('ERR_EXPECTING_ATEXT');
285
        }
286
287
        if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN && $this->lexer->isNextToken(EmailLexer::S_DOT)) {
288
            throw new \InvalidArgumentException('ERR_DOMAINHYPHENEND');
289
        }
290
291
        if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH
292
            && $this->lexer->isNextToken(EmailLexer::GENERIC)) {
@@ 291-294 (lines=4) @@
288
            throw new \InvalidArgumentException('ERR_DOMAINHYPHENEND');
289
        }
290
291
        if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH
292
            && $this->lexer->isNextToken(EmailLexer::GENERIC)) {
293
            throw new \InvalidArgumentException('ERR_EXPECTING_ATEXT');
294
        }
295
    }
296
297
    protected function hasBrackets($openBrackets)

src/Egulias/EmailValidator/Parser/LocalPart.php 1 location

@@ 43-47 (lines=5) @@
40
41
            $this->checkConsecutiveDots();
42
43
            if ($this->lexer->token['type'] === EmailLexer::S_DOT &&
44
                $this->lexer->isNextToken(EmailLexer::S_AT)
45
            ) {
46
                throw new \InvalidArgumentException('ERR_DOT_END');
47
            }
48
49
            $this->warnEscaping();
50
            $this->isInvalidToken($this->lexer->token, $closingQuote);

src/Egulias/EmailValidator/Parser/Parser.php 3 locations

@@ 37-40 (lines=4) @@
34
     */
35
    protected function validateQuotedPair()
36
    {
37
        if (!($this->lexer->token['type'] === EmailLexer::INVALID
38
            || $this->lexer->token['type'] === EmailLexer::C_DEL)) {
39
            throw new \InvalidArgumentException('ERR_EXPECTING_QPAIR');
40
        }
41
42
        $this->warnings[] = EmailValidator::DEPREC_QP;
43
    }
@@ 92-94 (lines=3) @@
89
            throw new \InvalidArgumentException('ERR_ATEXT_AFTER_CFWS');
90
        }
91
92
        if ($this->lexer->token['type'] === EmailLexer::S_LF || $this->lexer->token['type'] === EmailLexer::C_NUL) {
93
            throw new \InvalidArgumentException('ERR_EXPECTING_CTEXT');
94
        }
95
96
        if ($this->lexer->isNextToken(EmailLexer::S_AT) || $previous['type']  === EmailLexer::S_AT) {
97
            $this->warnings[] = EmailValidator::DEPREC_CFWS_NEAR_AT;
@@ 105-107 (lines=3) @@
102
103
    protected function checkConsecutiveDots()
104
    {
105
        if ($this->lexer->token['type'] === EmailLexer::S_DOT && $this->lexer->isNextToken(EmailLexer::S_DOT)) {
106
            throw new \InvalidArgumentException('ERR_CONSECUTIVEDOTS');
107
        }
108
    }
109
110
    protected function isFWS()