Code Duplication    Length = 21-21 lines in 4 locations

src/PlaygroundGame/Controller/Frontend/LotteryController.php 4 locations

@@ 157-177 (lines=21) @@
154
        return $viewModel;
155
    }
156
157
    public function fbshareAction()
158
    {
159
        $sg = $this->getGameService();
160
        $result = parent::fbshareAction();
161
        $bonusEntry = false;
162
163
        if ($result->getVariable('success')) {
164
            $identifier = $this->getEvent()->getRouteMatch()->getParam('id');
165
            $user = $this->zfcUserAuthentication()->getIdentity();
166
            $game = $sg->checkGame($identifier);
167
            $bonusEntry = $sg->addAnotherChance($game, $user, 1);
168
        }
169
170
        $response = $this->getResponse();
171
        $response->setContent(\Zend\Json\Json::encode(array(
172
            'success' => $result,
173
            'playBonus' => $bonusEntry
174
         )));
175
176
        return $response;
177
    }
178
179
    public function fbrequestAction()
180
    {
@@ 179-199 (lines=21) @@
176
        return $response;
177
    }
178
179
    public function fbrequestAction()
180
    {
181
        $sg = $this->getGameService();
182
        $result = parent::fbrequestAction();
183
        $bonusEntry = false;
184
185
        if ($result->getVariable('success')) {
186
            $identifier = $this->getEvent()->getRouteMatch()->getParam('id');
187
            $user = $this->zfcUserAuthentication()->getIdentity();
188
            $game = $sg->checkGame($identifier);
189
            $bonusEntry = $sg->addAnotherChance($game, $user, 1);
190
        }
191
192
        $response = $this->getResponse();
193
        $response->setContent(\Zend\Json\Json::encode(array(
194
            'success' => $result,
195
            'playBonus' => $bonusEntry
196
        )));
197
198
        return $response;
199
    }
200
201
    public function tweetAction()
202
    {
@@ 201-221 (lines=21) @@
198
        return $response;
199
    }
200
201
    public function tweetAction()
202
    {
203
        $sg = $this->getGameService();
204
        $result = parent::tweetAction();
205
        $bonusEntry = false;
206
207
        if ($result->getVariable('success')) {
208
            $identifier = $this->getEvent()->getRouteMatch()->getParam('id');
209
            $user = $this->zfcUserAuthentication()->getIdentity();
210
            $game = $sg->checkGame($identifier);
211
            $bonusEntry = $sg->addAnotherChance($game, $user, 1);
212
        }
213
214
        $response = $this->getResponse();
215
        $response->setContent(\Zend\Json\Json::encode(array(
216
            'success' => $result,
217
            'playBonus' => $bonusEntry
218
        )));
219
220
        return $response;
221
    }
222
223
    public function googleAction()
224
    {
@@ 223-243 (lines=21) @@
220
        return $response;
221
    }
222
223
    public function googleAction()
224
    {
225
        $sg = $this->getGameService();
226
        $result = parent::googleAction();
227
        $bonusEntry = false;
228
229
        if ($result->getVariable('success')) {
230
            $identifier = $this->getEvent()->getRouteMatch()->getParam('id');
231
            $user = $this->zfcUserAuthentication()->getIdentity();
232
            $game = $sg->checkGame($identifier);
233
            $bonusEntry = $sg->addAnotherChance($game, $user, 1);
234
        }
235
236
        $response = $this->getResponse();
237
        $response->setContent(\Zend\Json\Json::encode(array(
238
            'success' => $result,
239
            'playBonus' => $bonusEntry
240
        )));
241
242
        return $response;
243
    }
244
245
    public function getGameService()
246
    {