Code Duplication    Length = 11-11 lines in 4 locations

src/PlaygroundGame/Controller/Frontend/PostVoteController.php 3 locations

@@ 63-73 (lines=11) @@
60
61
        if (!$entry) {
62
            $lastEntry = $sg->findLastInactiveEntry($game, $user);
63
            if ($lastEntry === null) {
64
                return $this->redirect()->toUrl(
65
                    $this->frontendUrl()->fromRoute(
66
                        'postvote',
67
                        array(
68
                            'id' => $identifier,
69
                            
70
                        )
71
                    )
72
                );
73
            }
74
75
            $lastEntryId = $lastEntry->getId();
76
            $lastPost = $sg->getPostVotePostMapper()->findOneBy(array('entry' => $lastEntryId));
@@ 424-434 (lines=11) @@
421
        // Has the user finished the game ?
422
        $lastEntry = $this->getGameService()->findLastInactiveEntry($game, $user);
423
424
        if ($lastEntry === null) {
425
            return $this->redirect()->toUrl(
426
                $this->frontendUrl()->fromRoute(
427
                    'postvote',
428
                    array('id' => $identifier)
429
                )
430
            );
431
        }
432
433
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
434
        $form->setAttribute('method', 'post');
435
436
        if ($this->getRequest()->isPost()) {
437
            $data = $this->getRequest()->getPost()->toArray();
@@ 798-808 (lines=11) @@
795
        // Has the user finished the game ?
796
        $lastEntry = $this->getGameService()->findLastInactiveEntry($game, $user);
797
    
798
        if ($lastEntry === null) {
799
            return $this->redirect()->toUrl(
800
                $this->frontendUrl()->fromRoute(
801
                    'postvote',
802
                    array('id' => $identifier)
803
                )
804
            );
805
        }
806
    
807
        $post = $sg->getPostVotePostMapper()->findOneBy(array('entry' => $lastEntry));
808
    
809
        $secretKey = strtoupper(substr(sha1(uniqid('pg_', true).'####'.time()), 0, 15));
810
        $socialLinkUrl = $this->frontendUrl()->fromRoute(
811
            'postvote/post',

src/PlaygroundGame/Controller/Frontend/GameController.php 1 location

@@ 798-808 (lines=11) @@
795
        // Has the user finished the game ?
796
        $lastEntry = $this->getGameService()->findLastInactiveEntry($game, $user);
797
    
798
        if ($lastEntry === null) {
799
            return $this->redirect()->toUrl(
800
                $this->frontendUrl()->fromRoute(
801
                    'postvote',
802
                    array(
803
                        'id' => $identifier,
804
                        
805
                    )
806
                )
807
            );
808
        }
809
    
810
        if (!$user && !$game->getAnonymousAllowed()) {
811
            $redirect = urlencode(