Code Duplication    Length = 7-11 lines in 5 locations

EmailValidator/Parser/LocalPart.php 3 locations

@@ 94-103 (lines=10) @@
91
        return new ValidEmail();
92
    }
93
94
    protected function parseLocalFWS() : Result 
95
    {
96
        //use $this->parseFWS()
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
}

EmailValidator/Parser/DomainPart.php 1 location

@@ 115-125 (lines=11) @@
112
        return $this->domainPart;
113
    }
114
115
    protected function parseComments()
116
    {
117
        $commentParser = new Comment($this->lexer, new DomainComment());
118
        $result = $commentParser->parse('remove');
119
        if($result->isInvalid()) {
120
            return $result;
121
        }
122
123
        $this->warnings = array_merge($this->warnings, $commentParser->getWarnings());
124
        return $result;
125
    }
126
127
    protected function doParseDomainPart() : Result
128
    {

EmailValidator/Parser/Parser.php 1 location

@@ 46-52 (lines=7) @@
43
     */
44
    abstract public function parse($str);
45
46
    protected function parseFWS() : Result
47
    {
48
        $foldingWS = new FoldingWhiteSpace($this->lexer);
49
        $resultFWS = $foldingWS->parse('remove');
50
        $this->warnings = array_merge($this->warnings, $foldingWS->getWarnings());
51
        return $resultFWS;
52
    }
53
54
    protected function checkConsecutiveDots() : Result
55
    {