Code Duplication    Length = 4-19 lines in 7 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
            
@@ 165-168 (lines=4) @@
162
            $occurrence = current($occurrences);
163
        }
164
165
        if (!$user && !$game->getAnonymousAllowed()) {
166
            $redirect = urlencode(
167
                $this->frontendUrl()->fromRoute(
168
                    'instantwin/result',
169
                    array('id' => $game->getIdentifier(), 'channel' => $channel)
170
                )
171
            );

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/PostVoteController.php 2 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

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

@@ 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/GameController.php 1 location

@@ 416-433 (lines=18) @@
413
                $user = $view->user;
414
415
                // If the user can not be created/retrieved from Facebook info, redirect to login/register form
416
                if (!$user) {
417
                    $redirectUrl = urlencode(
418
                        $this->frontendUrl()->fromRoute(
419
                            $game->getClassType() .'/play',
420
                            array(
421
                                'id' => $game->getIdentifier(),
422
                                'channel' => $channel
423
                            ),
424
                            array('force_canonical' => true)
425
                        )
426
                    );
427
                    $redirect =  $this->redirect()->toUrl(
428
                        $this->frontendUrl()->fromRoute(
429
                            'zfcuser/register',
430
                            array('channel' => $channel)
431
                        ) . '?redirect='.$redirectUrl
432
                    );
433
                }
434
            }
435
436
            if ($game->getFbFan()) {