Code Duplication    Length = 21-21 lines in 4 locations

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

@@ 259-279 (lines=21) @@
256
        return $subViewModel;
257
    }
258
259
    public function fbshareAction()
260
    {
261
        $sg         = $this->getGameService();
262
        $result     = parent::fbshareAction();
263
        $bonusEntry = false;
264
265
        if ($result) {
266
            $identifier = $this->getEvent()->getRouteMatch()->getParam('id');
267
            $user       = $this->zfcUserAuthentication()->getIdentity();
268
            $game       = $sg->checkGame($identifier);
269
            $bonusEntry = $sg->addAnotherChance($game, $user, 1);
270
        }
271
272
        $response = $this->getResponse();
273
        $response->setContent(\Zend\Json\Json::encode(array(
274
                    'success'   => $result,
275
                    'playBonus' => $bonusEntry,
276
                )));
277
278
        return $response;
279
    }
280
281
    public function fbrequestAction()
282
    {
@@ 281-301 (lines=21) @@
278
        return $response;
279
    }
280
281
    public function fbrequestAction()
282
    {
283
        $sg         = $this->getGameService();
284
        $result     = parent::fbrequestAction();
285
        $bonusEntry = false;
286
287
        if ($result) {
288
            $identifier = $this->getEvent()->getRouteMatch()->getParam('id');
289
            $user       = $this->zfcUserAuthentication()->getIdentity();
290
            $game       = $sg->checkGame($identifier);
291
            $bonusEntry = $sg->addAnotherChance($game, $user, 1);
292
        }
293
294
        $response = $this->getResponse();
295
        $response->setContent(\Zend\Json\Json::encode(array(
296
                    'success'   => $result,
297
                    'playBonus' => $bonusEntry,
298
                )));
299
300
        return $response;
301
    }
302
303
    public function tweetAction()
304
    {
@@ 303-323 (lines=21) @@
300
        return $response;
301
    }
302
303
    public function tweetAction()
304
    {
305
        $sg         = $this->getGameService();
306
        $result     = parent::tweetAction();
307
        $bonusEntry = false;
308
309
        if ($result) {
310
            $identifier = $this->getEvent()->getRouteMatch()->getParam('id');
311
            $user       = $this->zfcUserAuthentication()->getIdentity();
312
            $game       = $sg->checkGame($identifier);
313
            $bonusEntry = $sg->addAnotherChance($game, $user, 1);
314
        }
315
316
        $response = $this->getResponse();
317
        $response->setContent(\Zend\Json\Json::encode(array(
318
                    'success'   => $result,
319
                    'playBonus' => $bonusEntry,
320
                )));
321
322
        return $response;
323
    }
324
325
    public function googleAction()
326
    {
@@ 325-345 (lines=21) @@
322
        return $response;
323
    }
324
325
    public function googleAction()
326
    {
327
        $sg         = $this->getGameService();
328
        $result     = parent::googleAction();
329
        $bonusEntry = false;
330
331
        if ($result) {
332
            $identifier = $this->getEvent()->getRouteMatch()->getParam('id');
333
            $user       = $this->zfcUserAuthentication()->getIdentity();
334
            $game       = $sg->checkGame($identifier);
335
            $bonusEntry = $sg->addAnotherChance($game, $user, 1);
336
        }
337
338
        $response = $this->getResponse();
339
        $response->setContent(\Zend\Json\Json::encode(array(
340
                    'success'   => $result,
341
                    'playBonus' => $bonusEntry,
342
                )));
343
344
        return $response;
345
    }
346
347
    public function getGameService()
348
    {