Code Duplication    Length = 4-19 lines in 10 locations

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

@@ 31-49 (lines=19) @@
28
29
        $user = $this->zfcUserAuthentication()->getIdentity();
30
31
        if (!$user && !$game->getAnonymousAllowed()) {
32
            $redirect = urlencode(
33
                $this->frontendUrl()->fromRoute(
34
                    $game->getClassType() . '/play',
35
                    array(
36
                        'id' => $game->getIdentifier(),
37
                        'channel' => $channel
38
                    ),
39
                    array('force_canonical' => true)
40
                )
41
            );
42
43
            return $this->redirect()->toUrl(
44
                $this->frontendUrl()->fromRoute(
45
                    'zfcuser/register',
46
                    array('channel' => $channel)
47
                ) . '?redirect='.$redirect
48
            );
49
        }
50
51
        if ($game->getOccurrenceType()=='datetime') {
52
            
@@ 171-174 (lines=4) @@
168
            $occurrence = current($occurrences);
169
        }
170
171
        if (!$user && !$game->getAnonymousAllowed()) {
172
            $redirect = urlencode(
173
                $this->frontendUrl()->fromRoute(
174
                    'instantwin/result',
175
                    array('id' => $game->getIdentifier(), 'channel' => $channel)
176
                )
177
            );

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

@@ 36-40 (lines=5) @@
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(), 'channel' => $channel),
41
                    array('force_canonical' => true)
42
                )
43
            );

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

@@ 112-115 (lines=4) @@
109
            );
110
        }
111
112
        if (!$user && !$game->getAnonymousAllowed()) {
113
            $redirect = urlencode(
114
                $this->frontendUrl()->fromRoute(
115
                    'lottery/result',
116
                    array('id' => $game->getIdentifier(), 'channel' => $channel)
117
                )
118
            );
@@ 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(), 'channel' => $channel),
35
                    array('force_canonical' => true)
36
                )
37
            );
38
39
            return $this->redirect()->toUrl(
40
                $this->frontendUrl()->fromRoute(
41
                    'zfcuser/register',
42
                    array('channel' => $channel)
43
                ) . '?redirect='.$redirect
44
            );
45
        }
46
47
        $entry = $sg->play($game, $user);
48
        if (!$entry) {

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(), 'channel' => $channel),
47
                    array('force_canonical' => true)
48
                )
49
            );
50
51
            return $this->redirect()->toUrl(
52
                $this->frontendUrl()->fromRoute(
53
                    'zfcuser/register',
54
                    array('channel' => $channel)
55
                ) . '?redirect='.$redirect
56
            );
57
        }
58
59
        $entry = $sg->play($game, $user);
60
@@ 420-423 (lines=4) @@
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
                        'channel' => $channel
@@ 822-825 (lines=4) @@
819
        // With core shortener helper
820
        $socialLinkUrl = $this->shortenUrl()->shortenUrl($socialLinkUrl);
821
    
822
        if (!$user && !$game->getAnonymousAllowed()) {
823
            $redirect = urlencode(
824
                $this->frontendUrl()->fromRoute(
825
                    'postvote/result',
826
                    array('id' => $game->getIdentifier(), 'channel' => $channel)
827
                )
828
            );

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

@@ 396-413 (lines=18) @@
393
                $user = $view->user;
394
395
                // If the user can not be created/retrieved from Facebook info, redirect to login/register form
396
                if (!$user) {
397
                    $redirectUrl = urlencode(
398
                        $this->frontendUrl()->fromRoute(
399
                            $game->getClassType() .'/play',
400
                            array(
401
                                'id' => $game->getIdentifier(),
402
                                'channel' => $channel
403
                            ),
404
                            array('force_canonical' => true)
405
                        )
406
                    );
407
                    $redirect =  $this->redirect()->toUrl(
408
                        $this->frontendUrl()->fromRoute(
409
                            'zfcuser/register',
410
                            array('channel' => $channel)
411
                        ) . '?redirect='.$redirectUrl
412
                    );
413
                }
414
            }
415
416
            if ($game->getFbFan()) {
@@ 828-831 (lines=4) @@
825
            );
826
        }
827
    
828
        if (!$user && !$game->getAnonymousAllowed()) {
829
            $redirect = urlencode(
830
                $this->frontendUrl()->fromRoute(
831
                    'postvote/result',
832
                    array(
833
                        'id' => $game->getIdentifier(),
834
                        'channel' => $channel