Code Duplication    Length = 4-19 lines in 6 locations

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 1 location

@@ 30-48 (lines=19) @@
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) {
49
            // the user has already taken part of this game and the participation limit has been reached
50
            $this->flashMessenger()->addMessage('Vous avez déjà participé');
51

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

@@ 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()) {

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

@@ 170-173 (lines=4) @@
167
            $occurrence = current($occurrences);
168
        }
169
170
        if (!$user && !$game->getAnonymousAllowed()) {
171
            $redirect = urlencode(
172
                $this->frontendUrl()->fromRoute(
173
                    'instantwin/result',
174
                    array('id' => $game->getIdentifier(), 'channel' => $channel)
175
                )
176
            );