Code Duplication    Length = 18-19 lines in 2 locations

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

@@ 111-128 (lines=18) @@
108
                $this->user = $view->user;
109
110
              // If the user cannot be created/retrieved from Facebook info, redirect to login/register form
111
                if (!$this->user) {
112
                    $redirect = urlencode(
113
                        $this->frontendUrl()->fromRoute(
114
                            'mission/play',
115
                            array('id'              => $this->game->getIdentifier()),
116
                            array('force_canonical' => true)
117
                        )
118
                    );
119
                    if (array_search('login', $this->game->getStepsArray())) {
120
                        return $this->redirect()->toUrl(
121
                            $this->frontendUrl()->fromRoute('mission/login').'?redirect='.$redirect
122
                        );
123
                    } else {
124
                        return $this->redirect()->toUrl(
125
                            $this->frontendUrl()->fromRoute('zfcuser/register').'?redirect='.$redirect
126
                        );
127
                    }
128
                }
129
130
              // The game is not played from Facebook : redirect to login/register form
131
            } elseif (!$this->game->getAnonymousAllowed()) {
@@ 131-149 (lines=19) @@
128
                }
129
130
              // The game is not played from Facebook : redirect to login/register form
131
            } elseif (!$this->game->getAnonymousAllowed()) {
132
                $redirect = urlencode(
133
                    $this->frontendUrl()->fromRoute(
134
                        'mission/play',
135
                        array('id'              => $this->game->getIdentifier()),
136
                        array('force_canonical' => true)
137
                    )
138
                );
139
140
                if (array_search('login', $this->game->getStepsArray())) {
141
                    return $this->redirect()->toUrl(
142
                        $this->frontendUrl()->fromRoute('mission/login').'?redirect='.$redirect
143
                    );
144
                } else {
145
                    return $this->redirect()->toUrl(
146
                        $this->frontendUrl()->fromRoute('zfcuser/register').'?redirect='.$redirect
147
                    );
148
                }
149
            }
150
        }
151
152
        $beforeLayout = $this->layout()->getTemplate();