Code Duplication    Length = 11-13 lines in 2 locations

src/Connection.php 2 locations

@@ 255-267 (lines=13) @@
252
        $this->sendReply(250, "Hello {$domain} @ {$this->getRemoteAddress()}");
253
    }
254
255
    protected function handleMailFromCommand($arguments)
256
    {
257
258
        // Parse the email.
259
        if (preg_match('/\<(?<email>.*)\>( .*)?/', $arguments, $matches) == 1) {
260
            $this->state = self::STATUS_FROM;
261
            $this->from  = $matches['email'];
262
            $this->sendReply(250, "MAIL OK");
263
        } else {
264
            $this->sendReply(500, "Invalid mail argument");
265
        }
266
267
    }
268
269
    protected function handleQuitCommand()
270
    {
@@ 275-285 (lines=11) @@
272
273
    }
274
275
    protected function handleRcptToCommand($arguments) {
276
        // Parse the recipient.
277
        if (preg_match('/^(?<name>.*?)\s*?\<(?<email>.*)\>\s*$/', $arguments, $matches) == 1) {
278
            // Always set to 3, since this command might occur multiple times.
279
            $this->state = self::STATUS_TO;
280
            $this->recipients[$matches['email']] = $matches['name'];
281
            $this->sendReply(250, "Accepted");
282
        } else {
283
            $this->sendReply(500, "Invalid RCPT TO argument.");
284
        }
285
    }
286
287
    protected function handleStartDataCommand()
288
    {