Code Duplication    Length = 21-21 lines in 4 locations

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

@@ 294-314 (lines=21) @@
291
        return $subViewModel;
292
    }
293
294
    public function fbshareAction()
295
    {
296
         $sg = $this->getGameService();
297
         $result = parent::fbshareAction();
298
         $bonusEntry = false;
299
300
         if ($result) {
301
             $identifier = $this->getEvent()->getRouteMatch()->getParam('id');
302
             $user = $this->zfcUserAuthentication()->getIdentity();
303
             $game = $sg->checkGame($identifier);
304
             $bonusEntry = $sg->addAnotherChance($game, $user, 1);
305
         }
306
307
         $response = $this->getResponse();
308
         $response->setContent(\Zend\Json\Json::encode(array(
309
            'success' => $result,
310
            'playBonus' => $bonusEntry
311
         )));
312
313
         return $response;
314
    }
315
316
    public function fbrequestAction()
317
    {
@@ 316-336 (lines=21) @@
313
         return $response;
314
    }
315
316
    public function fbrequestAction()
317
    {
318
        $sg = $this->getGameService();
319
        $result = parent::fbrequestAction();
320
        $bonusEntry = false;
321
322
        if ($result) {
323
            $identifier = $this->getEvent()->getRouteMatch()->getParam('id');
324
            $user = $this->zfcUserAuthentication()->getIdentity();
325
            $game = $sg->checkGame($identifier);
326
            $bonusEntry = $sg->addAnotherChance($game, $user, 1);
327
        }
328
329
        $response = $this->getResponse();
330
        $response->setContent(\Zend\Json\Json::encode(array(
331
            'success' => $result,
332
            'playBonus' => $bonusEntry
333
        )));
334
335
        return $response;
336
    }
337
338
    public function tweetAction()
339
    {
@@ 338-358 (lines=21) @@
335
        return $response;
336
    }
337
338
    public function tweetAction()
339
    {
340
        $sg = $this->getGameService();
341
        $result = parent::tweetAction();
342
        $bonusEntry = false;
343
344
        if ($result) {
345
            $identifier = $this->getEvent()->getRouteMatch()->getParam('id');
346
            $user = $this->zfcUserAuthentication()->getIdentity();
347
            $game = $sg->checkGame($identifier);
348
            $bonusEntry = $sg->addAnotherChance($game, $user, 1);
349
        }
350
351
        $response = $this->getResponse();
352
        $response->setContent(\Zend\Json\Json::encode(array(
353
            'success' => $result,
354
            'playBonus' => $bonusEntry
355
        )));
356
357
        return $response;
358
    }
359
360
    public function googleAction()
361
    {
@@ 360-380 (lines=21) @@
357
        return $response;
358
    }
359
360
    public function googleAction()
361
    {
362
        $sg = $this->getGameService();
363
        $result = parent::googleAction();
364
        $bonusEntry = false;
365
366
        if ($result) {
367
            $identifier = $this->getEvent()->getRouteMatch()->getParam('id');
368
            $user = $this->zfcUserAuthentication()->getIdentity();
369
            $game = $sg->checkGame($identifier);
370
            $bonusEntry = $sg->addAnotherChance($game, $user, 1);
371
        }
372
373
        $response = $this->getResponse();
374
        $response->setContent(\Zend\Json\Json::encode(array(
375
            'success' => $result,
376
            'playBonus' => $bonusEntry
377
        )));
378
379
        return $response;
380
    }
381
382
    public function getGameService()
383
    {