Code Duplication    Length = 11-14 lines in 3 locations

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

@@ 54-67 (lines=14) @@
51
        if ($game->getOccurrenceType()=='datetime') {
52
            
53
            $entry = $sg->play($game, $user);
54
            if (!$entry) {
55
                // the user has already taken part of this game and the participation limit has been reached
56
                $this->flashMessenger()->addMessage('Vous avez déjà participé');
57
58
                return $this->redirect()->toUrl(
59
                    $this->frontendUrl()->fromRoute(
60
                        'instantwin/result',
61
                        array(
62
                            'id' => $game->getIdentifier(),
63
                            'channel' => $channel
64
                        )
65
                    )
66
                );
67
            }
68
69
            // update the winner attribute in entry.
70
            $winner = $sg->IsInstantWinner($game, $user);
@@ 114-124 (lines=11) @@
111
                                array('force_canonical' => true)
112
                            )
113
                        );
114
                    } else {
115
                        return $this->redirect()->toUrl(
116
                            $this->frontendUrl()->fromRoute(
117
                                'instantwin/result',
118
                                array(
119
                                    'id' => $game->getIdentifier(),
120
                                    'channel' => $channel
121
                                )
122
                            )
123
                        );
124
                    }
125
                }
126
            }
127
            $viewVariables = array('form' => $form);
@@ 151-162 (lines=12) @@
148
        }
149
150
        $lastEntry = $sg->findLastInactiveEntry($game, $user);
151
        if (!$lastEntry) {
152
            return $this->redirect()->toUrl(
153
                $this->frontendUrl()->fromRoute(
154
                    'instantwin',
155
                    array('id' => $game->getIdentifier(), 'channel' => $channel),
156
                    array('force_canonical' => true)
157
                )
158
            );
159
        }
160
        $winner = $lastEntry->getWinner();
161
        $occurrence = null;
162
163
        // On tente de récupèrer l'occurrence si elle existe pour avoir accés au lot associé
164
        $occurrences = $sg->getInstantWinOccurrenceMapper()->findBy(
165
            array('instantwin' => $game->getId(), 'entry' => $lastEntry->getId())