Code Duplication    Length = 7-9 lines in 2 locations

src/Service/PostVote.php 2 locations

@@ 468-474 (lines=7) @@
465
        $game = $post->getPostvote();
466
467
        if ($user) {
468
            if ($comment == null) {
469
                $entryUser = count($postvoteVoteMapper->findBy(array('user' => $user, 'post' => $postId, 'postComment' => null)));
470
                $vote = $postvoteVoteMapper->findOneBy(array('user' => $user, 'post' => $postId, 'postComment' => null));
471
            } else {
472
                $entryUser = count($postvoteVoteMapper->findBy(array('user' => $user, 'post' => $postId, 'postComment' => $commentId)));
473
                $vote = $postvoteVoteMapper->findOneBy(array('user' => $user, 'post' => $postId, 'postComment' => $commentId));
474
            }
475
        } else {
476
            if ($comment == null) {
477
                $entryUser = count($postvoteVoteMapper->findBy(array('ip' => $ipAddress, 'post' => $postId, 'postComment' => null)));
@@ 475-483 (lines=9) @@
472
                $entryUser = count($postvoteVoteMapper->findBy(array('user' => $user, 'post' => $postId, 'postComment' => $commentId)));
473
                $vote = $postvoteVoteMapper->findOneBy(array('user' => $user, 'post' => $postId, 'postComment' => $commentId));
474
            }
475
        } else {
476
            if ($comment == null) {
477
                $entryUser = count($postvoteVoteMapper->findBy(array('ip' => $ipAddress, 'post' => $postId, 'postComment' => null)));
478
                $vote = $postvoteVoteMapper->findOneBy(array('ip' => $ipAddress, 'post' => $postId, 'postComment' => null));
479
            } else {
480
                $entryUser = count($postvoteVoteMapper->findBy(array('ip' => $ipAddress, 'post' => $postId, 'postComment' => $commentId)));
481
                $vote = $postvoteVoteMapper->findOneBy(array('ip' => $ipAddress, 'post' => $postId, 'postComment' => $commentId));
482
            }
483
        }
484
485
        if ($entryUser && $entryUser > 0) {
486
            $postvoteVoteMapper->remove($vote);