Code Duplication    Length = 7-9 lines in 2 locations

src/Service/PostVote.php 2 locations

@@ 495-501 (lines=7) @@
492
        $game = $post->getPostvote();
493
494
        if ($user) {
495
            if ($comment == null) {
496
                $entryUser = count($postvoteVoteMapper->findBy(array('user' => $user, 'post' => $postId, 'postComment' => null)));
497
                $vote = $postvoteVoteMapper->findOneBy(array('user' => $user, 'post' => $postId, 'postComment' => null));
498
            } else {
499
                $entryUser = count($postvoteVoteMapper->findBy(array('user' => $user, 'post' => $postId, 'postComment' => $commentId)));
500
                $vote = $postvoteVoteMapper->findOneBy(array('user' => $user, 'post' => $postId, 'postComment' => $commentId));
501
            }
502
        } else {
503
            if ($comment == null) {
504
                $entryUser = count($postvoteVoteMapper->findBy(array('ip' => $ipAddress, 'post' => $postId, 'postComment' => null)));
@@ 502-510 (lines=9) @@
499
                $entryUser = count($postvoteVoteMapper->findBy(array('user' => $user, 'post' => $postId, 'postComment' => $commentId)));
500
                $vote = $postvoteVoteMapper->findOneBy(array('user' => $user, 'post' => $postId, 'postComment' => $commentId));
501
            }
502
        } else {
503
            if ($comment == null) {
504
                $entryUser = count($postvoteVoteMapper->findBy(array('ip' => $ipAddress, 'post' => $postId, 'postComment' => null)));
505
                $vote = $postvoteVoteMapper->findOneBy(array('ip' => $ipAddress, 'post' => $postId, 'postComment' => null));
506
            } else {
507
                $entryUser = count($postvoteVoteMapper->findBy(array('ip' => $ipAddress, 'post' => $postId, 'postComment' => $commentId)));
508
                $vote = $postvoteVoteMapper->findOneBy(array('ip' => $ipAddress, 'post' => $postId, 'postComment' => $commentId));
509
            }
510
        }
511
512
        if ($entryUser && $entryUser > 0) {
513
            $postvoteVoteMapper->remove($vote);