Code Duplication    Length = 24-24 lines in 3 locations

src/Service/Game.php 3 locations

@@ 1178-1201 (lines=24) @@
1175
        $mailService->send($message);
1176
    }
1177
1178
    public function postFbWall($secretKey, $game, $user, $entry)
1179
    {
1180
        $topic = $game->getTitle();
1181
        
1182
        $shares = json_decode($entry->getSocialShares(), true);
1183
        if (!isset($shares['fbwall'])) {
1184
            $shares['fbwall'] = 1;
1185
        } else {
1186
            $shares['fbwall'] += 1;
1187
        }
1188
        $sharesJson = json_encode($shares);
1189
        $entry->setSocialShares($sharesJson);
1190
        $entry = $this->getEntryMapper()->update($entry);
1191
        
1192
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1193
            'user' => $user,
1194
            'game' => $game,
1195
            'secretKey' => $secretKey,
1196
            'topic' => $topic,
1197
            'entry' => $entry
1198
        ));
1199
1200
        return true;
1201
    }
1202
1203
    public function postFbRequest($secretKey, $game, $user, $entry, $to)
1204
    {
@@ 1227-1250 (lines=24) @@
1224
        return true;
1225
    }
1226
1227
    public function postTwitter($secretKey, $game, $user, $entry)
1228
    {
1229
        $topic = $game->getTitle();
1230
1231
        $shares = json_decode($entry->getSocialShares(), true);
1232
        if (!isset($shares['fbrequest'])) {
1233
            $shares['tweet'] = 1;
1234
        } else {
1235
            $shares['tweet'] += 1;
1236
        }
1237
        $sharesJson = json_encode($shares);
1238
        $entry->setSocialShares($sharesJson);
1239
        $entry = $this->getEntryMapper()->update($entry);
1240
        
1241
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1242
            'user' => $user,
1243
            'game' => $game,
1244
            'secretKey' => $secretKey,
1245
            'topic' => $topic,
1246
            'entry' => $entry
1247
        ));
1248
1249
        return true;
1250
    }
1251
1252
    public function postGoogle($secretKey, $game, $user, $entry)
1253
    {
@@ 1252-1275 (lines=24) @@
1249
        return true;
1250
    }
1251
1252
    public function postGoogle($secretKey, $game, $user, $entry)
1253
    {
1254
        $topic = $game->getTitle();
1255
        
1256
        $shares = json_decode($entry->getSocialShares(), true);
1257
        if (!isset($shares['fbrequest'])) {
1258
            $shares['google'] = 1;
1259
        } else {
1260
            $shares['google'] += 1;
1261
        }
1262
        $sharesJson = json_encode($shares);
1263
        $entry->setSocialShares($sharesJson);
1264
        $entry = $this->getEntryMapper()->update($entry);
1265
1266
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1267
            'user' => $user,
1268
            'game' => $game,
1269
            'secretKey' => $secretKey,
1270
            'topic' => $topic,
1271
            'entry' => $entry
1272
        ));
1273
1274
        return true;
1275
    }
1276
1277
    /**
1278
     * Is it possible to trigger a bonus entry ?