Code Duplication    Length = 24-24 lines in 3 locations

src/Service/Game.php 3 locations

@@ 1163-1186 (lines=24) @@
1160
        $mailService->send($message);
1161
    }
1162
1163
    public function postFbWall($secretKey, $game, $user, $entry)
1164
    {
1165
        $topic = $game->getTitle();
1166
        
1167
        $shares = json_decode($entry->getSocialShares(), true);
1168
        if (!isset($shares['fbwall'])) {
1169
            $shares['fbwall'] = 1;
1170
        } else {
1171
            $shares['fbwall'] += 1;
1172
        }
1173
        $sharesJson = json_encode($shares);
1174
        $entry->setSocialShares($sharesJson);
1175
        $entry = $this->getEntryMapper()->update($entry);
1176
        
1177
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1178
            'user' => $user,
1179
            'game' => $game,
1180
            'secretKey' => $secretKey,
1181
            'topic' => $topic,
1182
            'entry' => $entry
1183
        ));
1184
1185
        return true;
1186
    }
1187
1188
    public function postFbRequest($secretKey, $game, $user, $entry, $to)
1189
    {
@@ 1212-1235 (lines=24) @@
1209
        return true;
1210
    }
1211
1212
    public function postTwitter($secretKey, $game, $user, $entry)
1213
    {
1214
        $topic = $game->getTitle();
1215
1216
        $shares = json_decode($entry->getSocialShares(), true);
1217
        if (!isset($shares['fbrequest'])) {
1218
            $shares['tweet'] = 1;
1219
        } else {
1220
            $shares['tweet'] += 1;
1221
        }
1222
        $sharesJson = json_encode($shares);
1223
        $entry->setSocialShares($sharesJson);
1224
        $entry = $this->getEntryMapper()->update($entry);
1225
        
1226
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1227
            'user' => $user,
1228
            'game' => $game,
1229
            'secretKey' => $secretKey,
1230
            'topic' => $topic,
1231
            'entry' => $entry
1232
        ));
1233
1234
        return true;
1235
    }
1236
1237
    public function postGoogle($secretKey, $game, $user, $entry)
1238
    {
@@ 1237-1260 (lines=24) @@
1234
        return true;
1235
    }
1236
1237
    public function postGoogle($secretKey, $game, $user, $entry)
1238
    {
1239
        $topic = $game->getTitle();
1240
        
1241
        $shares = json_decode($entry->getSocialShares(), true);
1242
        if (!isset($shares['fbrequest'])) {
1243
            $shares['google'] = 1;
1244
        } else {
1245
            $shares['google'] += 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
    /**
1263
     * Is it possible to trigger a bonus entry ?