Code Duplication    Length = 24-24 lines in 3 locations

src/Service/Game.php 3 locations

@@ 1316-1339 (lines=24) @@
1313
        $mailService->send($message);
1314
    }
1315
1316
    public function postFbWall($secretKey, $game, $user, $entry)
1317
    {
1318
        $topic = $game->getTitle();
1319
        
1320
        $shares = json_decode($entry->getSocialShares(), true);
1321
        if (!isset($shares['fbwall'])) {
1322
            $shares['fbwall'] = 1;
1323
        } else {
1324
            $shares['fbwall'] += 1;
1325
        }
1326
        $sharesJson = json_encode($shares);
1327
        $entry->setSocialShares($sharesJson);
1328
        $entry = $this->getEntryMapper()->update($entry);
1329
        
1330
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1331
            'user' => $user,
1332
            'game' => $game,
1333
            'secretKey' => $secretKey,
1334
            'topic' => $topic,
1335
            'entry' => $entry
1336
        ));
1337
1338
        return true;
1339
    }
1340
1341
    public function postFbRequest($secretKey, $game, $user, $entry, $to)
1342
    {
@@ 1365-1388 (lines=24) @@
1362
        return true;
1363
    }
1364
1365
    public function postTwitter($secretKey, $game, $user, $entry)
1366
    {
1367
        $topic = $game->getTitle();
1368
1369
        $shares = json_decode($entry->getSocialShares(), true);
1370
        if (!isset($shares['fbrequest'])) {
1371
            $shares['tweet'] = 1;
1372
        } else {
1373
            $shares['tweet'] += 1;
1374
        }
1375
        $sharesJson = json_encode($shares);
1376
        $entry->setSocialShares($sharesJson);
1377
        $entry = $this->getEntryMapper()->update($entry);
1378
        
1379
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1380
            'user' => $user,
1381
            'game' => $game,
1382
            'secretKey' => $secretKey,
1383
            'topic' => $topic,
1384
            'entry' => $entry
1385
        ));
1386
1387
        return true;
1388
    }
1389
1390
    public function postGoogle($secretKey, $game, $user, $entry)
1391
    {
@@ 1390-1413 (lines=24) @@
1387
        return true;
1388
    }
1389
1390
    public function postGoogle($secretKey, $game, $user, $entry)
1391
    {
1392
        $topic = $game->getTitle();
1393
        
1394
        $shares = json_decode($entry->getSocialShares(), true);
1395
        if (!isset($shares['fbrequest'])) {
1396
            $shares['google'] = 1;
1397
        } else {
1398
            $shares['google'] += 1;
1399
        }
1400
        $sharesJson = json_encode($shares);
1401
        $entry->setSocialShares($sharesJson);
1402
        $entry = $this->getEntryMapper()->update($entry);
1403
1404
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1405
            'user' => $user,
1406
            'game' => $game,
1407
            'secretKey' => $secretKey,
1408
            'topic' => $topic,
1409
            'entry' => $entry
1410
        ));
1411
1412
        return true;
1413
    }
1414
1415
    /**
1416
     * Is it possible to trigger a bonus entry ?