Code Duplication    Length = 24-24 lines in 3 locations

src/Service/Game.php 3 locations

@@ 1237-1260 (lines=24) @@
1234
        $mailService->send($message);
1235
    }
1236
1237
    public function postFbWall($secretKey, $game, $user, $entry)
1238
    {
1239
        $topic = $game->getTitle();
1240
        
1241
        $shares = json_decode($entry->getSocialShares(), true);
1242
        if (!isset($shares['fbwall'])) {
1243
            $shares['fbwall'] = 1;
1244
        } else {
1245
            $shares['fbwall'] += 1;
1246
        }
1247
        $sharesJson = json_encode($shares);
1248
        $entry->setSocialShares($sharesJson);
1249
        $entry = $this->getEntryMapper()->update($entry);
1250
        
1251
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1252
            'user' => $user,
1253
            'game' => $game,
1254
            'secretKey' => $secretKey,
1255
            'topic' => $topic,
1256
            'entry' => $entry
1257
        ));
1258
1259
        return true;
1260
    }
1261
1262
    public function postFbRequest($secretKey, $game, $user, $entry, $to)
1263
    {
@@ 1286-1309 (lines=24) @@
1283
        return true;
1284
    }
1285
1286
    public function postTwitter($secretKey, $game, $user, $entry)
1287
    {
1288
        $topic = $game->getTitle();
1289
1290
        $shares = json_decode($entry->getSocialShares(), true);
1291
        if (!isset($shares['fbrequest'])) {
1292
            $shares['tweet'] = 1;
1293
        } else {
1294
            $shares['tweet'] += 1;
1295
        }
1296
        $sharesJson = json_encode($shares);
1297
        $entry->setSocialShares($sharesJson);
1298
        $entry = $this->getEntryMapper()->update($entry);
1299
        
1300
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1301
            'user' => $user,
1302
            'game' => $game,
1303
            'secretKey' => $secretKey,
1304
            'topic' => $topic,
1305
            'entry' => $entry
1306
        ));
1307
1308
        return true;
1309
    }
1310
1311
    public function postGoogle($secretKey, $game, $user, $entry)
1312
    {
@@ 1311-1334 (lines=24) @@
1308
        return true;
1309
    }
1310
1311
    public function postGoogle($secretKey, $game, $user, $entry)
1312
    {
1313
        $topic = $game->getTitle();
1314
        
1315
        $shares = json_decode($entry->getSocialShares(), true);
1316
        if (!isset($shares['fbrequest'])) {
1317
            $shares['google'] = 1;
1318
        } else {
1319
            $shares['google'] += 1;
1320
        }
1321
        $sharesJson = json_encode($shares);
1322
        $entry->setSocialShares($sharesJson);
1323
        $entry = $this->getEntryMapper()->update($entry);
1324
1325
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1326
            'user' => $user,
1327
            'game' => $game,
1328
            'secretKey' => $secretKey,
1329
            'topic' => $topic,
1330
            'entry' => $entry
1331
        ));
1332
1333
        return true;
1334
    }
1335
1336
    /**
1337
     * Is it possible to trigger a bonus entry ?