Code Duplication    Length = 14-17 lines in 7 locations

src/PlaygroundGame/Controller/Frontend/InstantWinController.php 2 locations

@@ 30-45 (lines=16) @@
27
28
        $user = $this->zfcUserAuthentication()->getIdentity();
29
30
        if (!$user && !$game->getAnonymousAllowed()) {
31
            $redirect = urlencode(
32
                $this->frontendUrl()->fromRoute(
33
                    $game->getClassType() . '/play',
34
                    array('id' => $game->getIdentifier()),
35
                    array('force_canonical' => true)
36
                )
37
            );
38
39
            return $this->redirect()->toUrl(
40
                $this->frontendUrl()->fromRoute(
41
                    'zfcuser/register',
42
                    array()
43
                ) . '?redirect='.$redirect
44
            );
45
        }
46
47
        if ($game->getOccurrenceType()=='datetime') {
48
            $entry = $sg->play($game, $user);
@@ 148-161 (lines=14) @@
145
            $occurrence = current($occurrences);
146
        }
147
148
        if (!$user && !$game->getAnonymousAllowed()) {
149
            $redirect = urlencode(
150
                $this->frontendUrl()->fromRoute(
151
                    'instantwin/result',
152
                    array('id' => $game->getIdentifier(), )
153
                )
154
            );
155
            return $this->redirect()->toUrl(
156
                $this->frontendUrl()->fromRoute(
157
                    'zfcuser/register',
158
                    array()
159
                ) . '?redirect='.$redirect
160
            );
161
        }
162
163
        $secretKey = strtoupper(substr(sha1(uniqid('pg_', true).'####'.time()), 0, 15));
164
        $socialLinkUrl = $this->frontendUrl()->fromRoute(

src/PlaygroundGame/Controller/Frontend/LotteryController.php 2 locations

@@ 30-45 (lines=16) @@
27
        }
28
29
        $user       = $this->zfcUserAuthentication()->getIdentity();
30
        if (!$user && !$game->getAnonymousAllowed()) {
31
            $redirect = urlencode(
32
                $this->frontendUrl()->fromRoute(
33
                    $game->getClassType() . '/play',
34
                    array('id' => $game->getIdentifier(), ),
35
                    array('force_canonical' => true)
36
                )
37
            );
38
39
            return $this->redirect()->toUrl(
40
                $this->frontendUrl()->fromRoute(
41
                    'zfcuser/register',
42
                    array()
43
                ) . '?redirect='.$redirect
44
            );
45
        }
46
47
        $entry = $sg->play($game, $user);
48
        if (!$entry) {
@@ 109-125 (lines=17) @@
106
            );
107
        }
108
109
        if (!$user && !$game->getAnonymousAllowed()) {
110
            $redirect = urlencode(
111
                $this->frontendUrl()->fromRoute(
112
                    'lottery/result',
113
                    array(
114
                        'id' => $game->getIdentifier(),
115
                        
116
                    )
117
                )
118
            );
119
            return $this->redirect()->toUrl(
120
                $this->frontendUrl()->fromRoute(
121
                    'zfcuser/register',
122
                    array()
123
                ) . '?redirect='.$redirect
124
            );
125
        }
126
127
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
128
        $form->setAttribute('method', 'post');

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

@@ 36-51 (lines=16) @@
33
34
        $user       = $this->zfcUserAuthentication()->getIdentity();
35
36
        if (!$user && !$game->getAnonymousAllowed()) {
37
            $redirect = urlencode(
38
                $this->frontendUrl()->fromRoute(
39
                    $game->getClassType() . '/play',
40
                    array('id' => $game->getIdentifier(), ),
41
                    array('force_canonical' => true)
42
                )
43
            );
44
45
            return $this->redirect()->toUrl(
46
                $this->frontendUrl()->fromRoute(
47
                    'zfcuser/register',
48
                    array()
49
                ) . '?redirect='.$redirect
50
            );
51
        }
52
53
        $entry = $sg->play($game, $user);
54
        if (!$entry) {

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

@@ 810-826 (lines=17) @@
807
            );
808
        }
809
    
810
        if (!$user && !$game->getAnonymousAllowed()) {
811
            $redirect = urlencode(
812
                $this->frontendUrl()->fromRoute(
813
                    'postvote/result',
814
                    array(
815
                        'id' => $game->getIdentifier(),
816
                        
817
                    )
818
                )
819
            );
820
            return $this->redirect()->toUrl(
821
                $this->frontendUrl()->fromRoute(
822
                    'zfcuser/register',
823
                    array()
824
                ) . '?redirect='.$redirect
825
            );
826
        }
827
    
828
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
829
        $form->setAttribute('method', 'post');

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

@@ 42-57 (lines=16) @@
39
40
        $user       = $this->zfcUserAuthentication()->getIdentity();
41
42
        if (!$user && !$game->getAnonymousAllowed()) {
43
            $redirect = urlencode(
44
                $this->frontendUrl()->fromRoute(
45
                    $game->getClassType() . '/play',
46
                    array('id' => $game->getIdentifier(), ),
47
                    array('force_canonical' => true)
48
                )
49
            );
50
51
            return $this->redirect()->toUrl(
52
                $this->frontendUrl()->fromRoute(
53
                    'zfcuser/register',
54
                    array()
55
                ) . '?redirect='.$redirect
56
            );
57
        }
58
59
        $entry = $sg->play($game, $user);
60