Code Duplication    Length = 24-24 lines in 3 locations

src/Service/Game.php 3 locations

@@ 1525-1548 (lines=24) @@
1522
        $mailService->send($message);
1523
    }
1524
1525
    public function postFbWall($secretKey, $game, $user, $entry)
1526
    {
1527
        $topic = $game->getTitle();
1528
        
1529
        $shares = json_decode($entry->getSocialShares(), true);
1530
        if (!isset($shares['fbwall'])) {
1531
            $shares['fbwall'] = 1;
1532
        } else {
1533
            $shares['fbwall'] += 1;
1534
        }
1535
        $sharesJson = json_encode($shares);
1536
        $entry->setSocialShares($sharesJson);
1537
        $entry = $this->getEntryMapper()->update($entry);
1538
        
1539
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1540
            'user' => $user,
1541
            'game' => $game,
1542
            'secretKey' => $secretKey,
1543
            'topic' => $topic,
1544
            'entry' => $entry
1545
        ));
1546
1547
        return true;
1548
    }
1549
1550
    public function postFbRequest($secretKey, $game, $user, $entry, $to)
1551
    {
@@ 1574-1597 (lines=24) @@
1571
        return true;
1572
    }
1573
1574
    public function postTwitter($secretKey, $game, $user, $entry)
1575
    {
1576
        $topic = $game->getTitle();
1577
1578
        $shares = json_decode($entry->getSocialShares(), true);
1579
        if (!isset($shares['fbrequest'])) {
1580
            $shares['tweet'] = 1;
1581
        } else {
1582
            $shares['tweet'] += 1;
1583
        }
1584
        $sharesJson = json_encode($shares);
1585
        $entry->setSocialShares($sharesJson);
1586
        $entry = $this->getEntryMapper()->update($entry);
1587
        
1588
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1589
            'user' => $user,
1590
            'game' => $game,
1591
            'secretKey' => $secretKey,
1592
            'topic' => $topic,
1593
            'entry' => $entry
1594
        ));
1595
1596
        return true;
1597
    }
1598
1599
    public function postGoogle($secretKey, $game, $user, $entry)
1600
    {
@@ 1599-1622 (lines=24) @@
1596
        return true;
1597
    }
1598
1599
    public function postGoogle($secretKey, $game, $user, $entry)
1600
    {
1601
        $topic = $game->getTitle();
1602
        
1603
        $shares = json_decode($entry->getSocialShares(), true);
1604
        if (!isset($shares['fbrequest'])) {
1605
            $shares['google'] = 1;
1606
        } else {
1607
            $shares['google'] += 1;
1608
        }
1609
        $sharesJson = json_encode($shares);
1610
        $entry->setSocialShares($sharesJson);
1611
        $entry = $this->getEntryMapper()->update($entry);
1612
1613
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1614
            'user' => $user,
1615
            'game' => $game,
1616
            'secretKey' => $secretKey,
1617
            'topic' => $topic,
1618
            'entry' => $entry
1619
        ));
1620
1621
        return true;
1622
    }
1623
1624
    /**
1625
     * Is it possible to trigger a bonus entry ?