Code Duplication    Length = 14-17 lines in 9 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/PostVoteController.php 3 locations

@@ 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
@@ 420-436 (lines=17) @@
417
            );
418
        }
419
420
        if (!$user && !$game->getAnonymousAllowed()) {
421
            $redirect = urlencode(
422
                $this->frontendUrl()->fromRoute(
423
                    'postvote/result',
424
                    array(
425
                        'id' => $game->getIdentifier(),
426
                        
427
                    )
428
                )
429
            );
430
            return $this->redirect()->toUrl(
431
                $this->frontendUrl()->fromRoute(
432
                    'zfcuser/register',
433
                    array()
434
                ) . '?redirect='.$redirect
435
            );
436
        }
437
438
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
439
        $form->setAttribute('method', 'post');
@@ 821-837 (lines=17) @@
818
        // With core shortener helper
819
        $socialLinkUrl = $this->shortenUrl()->shortenUrl($socialLinkUrl);
820
    
821
        if (!$user && !$game->getAnonymousAllowed()) {
822
            $redirect = urlencode(
823
                $this->frontendUrl()->fromRoute(
824
                    'postvote/result',
825
                    array(
826
                        'id' => $game->getIdentifier(),
827
                        
828
                    )
829
                )
830
            );
831
            return $this->redirect()->toUrl(
832
                $this->frontendUrl()->fromRoute(
833
                    'zfcuser/register',
834
                    array()
835
                ) . '?redirect='.$redirect
836
            );
837
        }
838
    
839
        $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form');
840
        $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');