Code Duplication    Length = 24-24 lines in 3 locations

src/Service/Game.php 3 locations

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