Code Duplication    Length = 24-24 lines in 3 locations

src/Service/Game.php 3 locations

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