Code Duplication    Length = 21-21 lines in 4 locations

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

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