Code Duplication    Length = 24-24 lines in 3 locations

src/PlaygroundGame/Service/Game.php 3 locations

@@ 1116-1139 (lines=24) @@
1113
        $mailService->send($message);
1114
    }
1115
1116
    public function postFbWall($secretKey, $game, $user, $entry)
1117
    {
1118
        $topic = $game->getTitle();
1119
        
1120
        $shares = json_decode($entry->getSocialShares(), true);
1121
        if (!isset($shares['fbwall'])) {
1122
            $shares['fbwall'] = 1;
1123
        } else {
1124
            $shares['fbwall'] += 1;
1125
        }
1126
        $sharesJson = json_encode($shares);
1127
        $entry->setSocialShares($sharesJson);
1128
        $entry = $this->getEntryMapper()->update($entry);
1129
        
1130
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1131
            'user' => $user,
1132
            'game' => $game,
1133
            'secretKey' => $secretKey,
1134
            'topic' => $topic,
1135
            'entry' => $entry
1136
        ));
1137
1138
        return true;
1139
    }
1140
1141
    public function postFbRequest($secretKey, $game, $user, $entry, $to)
1142
    {
@@ 1165-1188 (lines=24) @@
1162
        return true;
1163
    }
1164
1165
    public function postTwitter($secretKey, $game, $user, $entry)
1166
    {
1167
        $topic = $game->getTitle();
1168
1169
        $shares = json_decode($entry->getSocialShares(), true);
1170
        if (!isset($shares['fbrequest'])) {
1171
            $shares['tweet'] = 1;
1172
        } else {
1173
            $shares['tweet'] += 1;
1174
        }
1175
        $sharesJson = json_encode($shares);
1176
        $entry->setSocialShares($sharesJson);
1177
        $entry = $this->getEntryMapper()->update($entry);
1178
        
1179
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1180
            'user' => $user,
1181
            'game' => $game,
1182
            'secretKey' => $secretKey,
1183
            'topic' => $topic,
1184
            'entry' => $entry
1185
        ));
1186
1187
        return true;
1188
    }
1189
1190
    public function postGoogle($secretKey, $game, $user, $entry)
1191
    {
@@ 1190-1213 (lines=24) @@
1187
        return true;
1188
    }
1189
1190
    public function postGoogle($secretKey, $game, $user, $entry)
1191
    {
1192
        $topic = $game->getTitle();
1193
        
1194
        $shares = json_decode($entry->getSocialShares(), true);
1195
        if (!isset($shares['fbrequest'])) {
1196
            $shares['google'] = 1;
1197
        } else {
1198
            $shares['google'] += 1;
1199
        }
1200
        $sharesJson = json_encode($shares);
1201
        $entry->setSocialShares($sharesJson);
1202
        $entry = $this->getEntryMapper()->update($entry);
1203
1204
        $this->getEventManager()->trigger(__FUNCTION__ . '.post', $this, array(
1205
            'user' => $user,
1206
            'game' => $game,
1207
            'secretKey' => $secretKey,
1208
            'topic' => $topic,
1209
            'entry' => $entry
1210
        ));
1211
1212
        return true;
1213
    }
1214
1215
    /**
1216
     * Is it possible to trigger a bonus entry ?