Code Duplication    Length = 24-24 lines in 3 locations

src/Service/Game.php 3 locations

@@ 1557-1580 (lines=24) @@
1554
        $mailService->send($message);
1555
    }
1556
1557
    public function postFbWall($secretKey, $game, $user, $entry)
1558
    {
1559
        $topic = $game->getTitle();
1560
1561
        $shares = json_decode($entry->getSocialShares(), true);
1562
        if (!isset($shares['fbwall'])) {
1563
            $shares['fbwall'] = 1;
1564
        } else {
1565
            $shares['fbwall'] += 1;
1566
        }
1567
        $sharesJson = json_encode($shares);
1568
        $entry->setSocialShares($sharesJson);
1569
        $entry = $this->getEntryMapper()->update($entry);
1570
1571
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1572
            'user' => $user,
1573
            'game' => $game,
1574
            'secretKey' => $secretKey,
1575
            'topic' => $topic,
1576
            'entry' => $entry
1577
        ));
1578
1579
        return true;
1580
    }
1581
1582
    public function postFbRequest($secretKey, $game, $user, $entry, $to)
1583
    {
@@ 1606-1629 (lines=24) @@
1603
        return true;
1604
    }
1605
1606
    public function postTwitter($secretKey, $game, $user, $entry)
1607
    {
1608
        $topic = $game->getTitle();
1609
1610
        $shares = json_decode($entry->getSocialShares(), true);
1611
        if (!isset($shares['fbrequest'])) {
1612
            $shares['tweet'] = 1;
1613
        } else {
1614
            $shares['tweet'] += 1;
1615
        }
1616
        $sharesJson = json_encode($shares);
1617
        $entry->setSocialShares($sharesJson);
1618
        $entry = $this->getEntryMapper()->update($entry);
1619
1620
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1621
            'user' => $user,
1622
            'game' => $game,
1623
            'secretKey' => $secretKey,
1624
            'topic' => $topic,
1625
            'entry' => $entry
1626
        ));
1627
1628
        return true;
1629
    }
1630
1631
    public function postGoogle($secretKey, $game, $user, $entry)
1632
    {
@@ 1631-1654 (lines=24) @@
1628
        return true;
1629
    }
1630
1631
    public function postGoogle($secretKey, $game, $user, $entry)
1632
    {
1633
        $topic = $game->getTitle();
1634
1635
        $shares = json_decode($entry->getSocialShares(), true);
1636
        if (!isset($shares['fbrequest'])) {
1637
            $shares['google'] = 1;
1638
        } else {
1639
            $shares['google'] += 1;
1640
        }
1641
        $sharesJson = json_encode($shares);
1642
        $entry->setSocialShares($sharesJson);
1643
        $entry = $this->getEntryMapper()->update($entry);
1644
1645
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1646
            'user' => $user,
1647
            'game' => $game,
1648
            'secretKey' => $secretKey,
1649
            'topic' => $topic,
1650
            'entry' => $entry
1651
        ));
1652
1653
        return true;
1654
    }
1655
1656
    /**
1657
     * Is it possible to trigger a bonus entry ?