Code Duplication    Length = 16-16 lines in 2 locations

src/Service/PostVote.php 2 locations

@@ 298-313 (lines=16) @@
295
                array('user' => $post->getUser(), 'game' => $game, 'entry' => $entry, 'post' => $post)
296
            );
297
298
            if ($game->getMailModerationValidated()) {
299
                $from = $this->getOptions()->getEmailFromAddress();
300
                if ($entry->getAnonymousIdentifier()) {
301
                    $to = $entry->getAnonymousIdentifier();
302
                } elseif ($post->getUser()) {
303
                    $to = $post->getUser()->getEmail();
304
                }
305
                $subject = $game->getMailModerationValidatedSubject();
306
                $data = [
307
                    'game' => $game,
308
                    'user' => $post->getUser(),
309
                    'entry' => $entry,
310
                    'content' => $game->getMailModerationValidatedBlock(),
311
                ];
312
                $this->mail($from, $to, $subject, 'moderation-validated', $data);
313
            }
314
        } elseif ($status && strtolower($status) === 'rejection') {
315
            // We reject the $post
316
            $post->setStatus(9);
@@ 333-348 (lines=16) @@
330
            $entryMapper = $this->getEntryMapper();
331
            $entryMapper->update($entry);
332
333
            if ($game->getMailModerationRejected()) {
334
                $from = $this->getOptions()->getEmailFromAddress();
335
                if ($entry->getAnonymousIdentifier()) {
336
                    $to = $entry->getAnonymousIdentifier();
337
                } elseif ($post->getUser()) {
338
                    $to = $post->getUser()->getEmail();
339
                }
340
                $subject = $game->getMailModerationRejectedSubject();
341
                $data = [
342
                    'game' => $game,
343
                    'user' => $post->getUser(),
344
                    'entry' => $entry,
345
                    'content' => $game->getMailModerationRejectedBlock(),
346
                ];
347
                $this->mail($from, $to, $subject, 'moderation-rejected', $data);
348
            }
349
        }
350
    }
351