Code Duplication    Length = 3-14 lines in 5 locations

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

@@ 56-67 (lines=12) @@
53
                // En post, je reçois la maj du form pour les gagnants.
54
                // Je n'ai pas à créer une nouvelle participation mais vérifier la précédente
55
                $lastEntry = $sg->findLastInactiveEntry($game, $user);
56
                if (!$lastEntry) {
57
                    return $this->redirect()->toUrl(
58
                        $this->frontendUrl()->fromRoute(
59
                            'instantwin',
60
                            array(
61
                                'id' => $game->getIdentifier(),
62
                                'channel' => $channel
63
                            ),
64
                            array('force_canonical' => true)
65
                        )
66
                    );
67
                }
68
                $winner = $lastEntry->getWinner();
69
                // if not winner, I'm not authorized to call this page in POST mode.
70
                if (!$winner) {
@@ 70-81 (lines=12) @@
67
                }
68
                $winner = $lastEntry->getWinner();
69
                // if not winner, I'm not authorized to call this page in POST mode.
70
                if (!$winner) {
71
                    return $this->redirect()->toUrl(
72
                        $this->frontendUrl()->fromRoute(
73
                            'instantwin',
74
                            array(
75
                                'id' => $game->getIdentifier(),
76
                                'channel' => $channel
77
                            ),
78
                            array('force_canonical' => true)
79
                        )
80
                    );
81
                }
82
            } else {
83
                // J'arrive sur le jeu, j'essaie donc de participer
84
                $entry = $sg->play($game, $user);
@@ 85-98 (lines=14) @@
82
            } else {
83
                // J'arrive sur le jeu, j'essaie donc de participer
84
                $entry = $sg->play($game, $user);
85
                if (!$entry) {
86
                    // the user has already taken part of this game and the participation limit has been reached
87
                    $this->flashMessenger()->addMessage('Vous avez déjà participé');
88
89
                    return $this->redirect()->toUrl(
90
                        $this->frontendUrl()->fromRoute(
91
                            'instantwin/result',
92
                            array(
93
                                'id' => $game->getIdentifier(),
94
                                'channel' => $channel
95
                            )
96
                        )
97
                    );
98
                }
99
100
                // update the winner attribute in entry.
101
                $winner = $sg->IsInstantWinner($game, $user);
@@ 145-155 (lines=11) @@
142
                                array('force_canonical' => true)
143
                            )
144
                        );
145
                    } else {
146
                        return $this->redirect()->toUrl(
147
                            $this->frontendUrl()->fromRoute(
148
                                'instantwin/result',
149
                                array(
150
                                    'id' => $game->getIdentifier(),
151
                                    'channel' => $channel
152
                                )
153
                            )
154
                        );
155
                    }
156
                }
157
            }
158
            $viewVariables = array('form' => $form);
@@ 182-184 (lines=3) @@
179
        }
180
181
        $lastEntry = $sg->findLastInactiveEntry($game, $user);
182
        if (!$lastEntry) {
183
            return $this->redirect()->toUrl(
184
                $this->frontendUrl()->fromRoute(
185
                    'instantwin',
186
                    array('id' => $game->getIdentifier(), 'channel' => $channel),
187
                    array('force_canonical' => true)