Code Duplication    Length = 24-24 lines in 3 locations

src/Service/Game.php 3 locations

@@ 1445-1468 (lines=24) @@
1442
        $mailService->send($message);
1443
    }
1444
1445
    public function postFbWall($secretKey, $game, $user, $entry)
1446
    {
1447
        $topic = $game->getTitle();
1448
        
1449
        $shares = json_decode($entry->getSocialShares(), true);
1450
        if (!isset($shares['fbwall'])) {
1451
            $shares['fbwall'] = 1;
1452
        } else {
1453
            $shares['fbwall'] += 1;
1454
        }
1455
        $sharesJson = json_encode($shares);
1456
        $entry->setSocialShares($sharesJson);
1457
        $entry = $this->getEntryMapper()->update($entry);
1458
        
1459
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1460
            'user' => $user,
1461
            'game' => $game,
1462
            'secretKey' => $secretKey,
1463
            'topic' => $topic,
1464
            'entry' => $entry
1465
        ));
1466
1467
        return true;
1468
    }
1469
1470
    public function postFbRequest($secretKey, $game, $user, $entry, $to)
1471
    {
@@ 1494-1517 (lines=24) @@
1491
        return true;
1492
    }
1493
1494
    public function postTwitter($secretKey, $game, $user, $entry)
1495
    {
1496
        $topic = $game->getTitle();
1497
1498
        $shares = json_decode($entry->getSocialShares(), true);
1499
        if (!isset($shares['fbrequest'])) {
1500
            $shares['tweet'] = 1;
1501
        } else {
1502
            $shares['tweet'] += 1;
1503
        }
1504
        $sharesJson = json_encode($shares);
1505
        $entry->setSocialShares($sharesJson);
1506
        $entry = $this->getEntryMapper()->update($entry);
1507
        
1508
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1509
            'user' => $user,
1510
            'game' => $game,
1511
            'secretKey' => $secretKey,
1512
            'topic' => $topic,
1513
            'entry' => $entry
1514
        ));
1515
1516
        return true;
1517
    }
1518
1519
    public function postGoogle($secretKey, $game, $user, $entry)
1520
    {
@@ 1519-1542 (lines=24) @@
1516
        return true;
1517
    }
1518
1519
    public function postGoogle($secretKey, $game, $user, $entry)
1520
    {
1521
        $topic = $game->getTitle();
1522
        
1523
        $shares = json_decode($entry->getSocialShares(), true);
1524
        if (!isset($shares['fbrequest'])) {
1525
            $shares['google'] = 1;
1526
        } else {
1527
            $shares['google'] += 1;
1528
        }
1529
        $sharesJson = json_encode($shares);
1530
        $entry->setSocialShares($sharesJson);
1531
        $entry = $this->getEntryMapper()->update($entry);
1532
1533
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1534
            'user' => $user,
1535
            'game' => $game,
1536
            'secretKey' => $secretKey,
1537
            'topic' => $topic,
1538
            'entry' => $entry
1539
        ));
1540
1541
        return true;
1542
    }
1543
1544
    /**
1545
     * Is it possible to trigger a bonus entry ?