Code Duplication    Length = 8-11 lines in 4 locations

EmailValidator/Parser/DomainPart.php 1 location

@@ 177-187 (lines=11) @@
174
        }
175
    }
176
177
    protected function parseComments()
178
    {
179
        $commentParser = new Comment($this->lexer, new DomainComment());
180
        $result = $commentParser->parse('remove');
181
        if($result->isInvalid()) {
182
            return $result;
183
        }
184
185
        $this->warnings = array_merge($this->warnings, $commentParser->getWarnings());
186
        return $result;
187
    }
188
189
    protected function doParseDomainPart() : Result
190
    {

EmailValidator/Parser/LocalPart.php 3 locations

@@ 94-103 (lines=10) @@
91
        return new ValidEmail();
92
    }
93
94
    protected function parseLocalFWS() : Result 
95
    {
96
97
        $foldingWS = new FoldingWhiteSpace($this->lexer);
98
        $resultFWS = $foldingWS->parse('remove');
99
        if ($resultFWS->isValid()) {
100
            $this->warnings = array_merge($this->warnings, $foldingWS->getWarnings());
101
        }
102
        return $resultFWS;
103
    }
104
105
    protected function hasDotAtStart() : bool
106
    {
@@ 110-117 (lines=8) @@
107
            return $this->lexer->token['type'] === EmailLexer::S_DOT && null === $this->lexer->getPrevious()['type'];
108
    }
109
110
    protected function parseDoubleQuote() : Result
111
    {
112
        $dquoteParser = new DoubleQuote($this->lexer);
113
        $parseAgain = $dquoteParser->parse("remove useless arg");
114
        $this->warnings = array_merge($this->warnings, $dquoteParser->getWarnings());
115
116
        return $parseAgain;
117
    }
118
119
    protected function parseComments()
120
    {
@@ 119-128 (lines=10) @@
116
        return $parseAgain;
117
    }
118
119
    protected function parseComments()
120
    {
121
        $commentParser = new Comment($this->lexer, new LocalComment());
122
        $result = $commentParser->parse('remove');
123
        $this->warnings = array_merge($this->warnings, $commentParser->getWarnings());
124
        if($result->isInvalid()) {
125
            return $result;
126
        }
127
        return $result;
128
    }
129
}