Code Duplication    Length = 8-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

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

EmailValidator/Parser/Parser.php 1 location

@@ 112-120 (lines=9) @@
109
        }
110
    }
111
112
    protected function parseFWS()
113
    {
114
        $foldingWS = new FoldingWhiteSpace($this->lexer);
115
        $resultFWS = $foldingWS->parse('remove');
116
        //if ($resultFWS->isValid()) {
117
            $this->warnings = array_merge($this->warnings, $foldingWS->getWarnings());
118
        //}
119
        return $resultFWS;
120
    }
121
122
    protected function checkConsecutiveDots()
123
    {