Code Duplication    Length = 24-24 lines in 3 locations

src/Service/Game.php 3 locations

@@ 1196-1219 (lines=24) @@
1193
        $mailService->send($message);
1194
    }
1195
1196
    public function postFbWall($secretKey, $game, $user, $entry)
1197
    {
1198
        $topic = $game->getTitle();
1199
        
1200
        $shares = json_decode($entry->getSocialShares(), true);
1201
        if (!isset($shares['fbwall'])) {
1202
            $shares['fbwall'] = 1;
1203
        } else {
1204
            $shares['fbwall'] += 1;
1205
        }
1206
        $sharesJson = json_encode($shares);
1207
        $entry->setSocialShares($sharesJson);
1208
        $entry = $this->getEntryMapper()->update($entry);
1209
        
1210
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1211
            'user' => $user,
1212
            'game' => $game,
1213
            'secretKey' => $secretKey,
1214
            'topic' => $topic,
1215
            'entry' => $entry
1216
        ));
1217
1218
        return true;
1219
    }
1220
1221
    public function postFbRequest($secretKey, $game, $user, $entry, $to)
1222
    {
@@ 1245-1268 (lines=24) @@
1242
        return true;
1243
    }
1244
1245
    public function postTwitter($secretKey, $game, $user, $entry)
1246
    {
1247
        $topic = $game->getTitle();
1248
1249
        $shares = json_decode($entry->getSocialShares(), true);
1250
        if (!isset($shares['fbrequest'])) {
1251
            $shares['tweet'] = 1;
1252
        } else {
1253
            $shares['tweet'] += 1;
1254
        }
1255
        $sharesJson = json_encode($shares);
1256
        $entry->setSocialShares($sharesJson);
1257
        $entry = $this->getEntryMapper()->update($entry);
1258
        
1259
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1260
            'user' => $user,
1261
            'game' => $game,
1262
            'secretKey' => $secretKey,
1263
            'topic' => $topic,
1264
            'entry' => $entry
1265
        ));
1266
1267
        return true;
1268
    }
1269
1270
    public function postGoogle($secretKey, $game, $user, $entry)
1271
    {
@@ 1270-1293 (lines=24) @@
1267
        return true;
1268
    }
1269
1270
    public function postGoogle($secretKey, $game, $user, $entry)
1271
    {
1272
        $topic = $game->getTitle();
1273
        
1274
        $shares = json_decode($entry->getSocialShares(), true);
1275
        if (!isset($shares['fbrequest'])) {
1276
            $shares['google'] = 1;
1277
        } else {
1278
            $shares['google'] += 1;
1279
        }
1280
        $sharesJson = json_encode($shares);
1281
        $entry->setSocialShares($sharesJson);
1282
        $entry = $this->getEntryMapper()->update($entry);
1283
1284
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1285
            'user' => $user,
1286
            'game' => $game,
1287
            'secretKey' => $secretKey,
1288
            'topic' => $topic,
1289
            'entry' => $entry
1290
        ));
1291
1292
        return true;
1293
    }
1294
1295
    /**
1296
     * Is it possible to trigger a bonus entry ?