Code Duplication    Length = 11-11 lines in 5 locations

src/Service/InstantWin.php 1 location

@@ 48-58 (lines=11) @@
45
                $game = $this->getGameMapper()->update($game);
46
            }
47
48
            if (isset($data['deleteScratchcardImage']) &&
49
                $data['deleteScratchcardImage'] &&
50
                empty($data['uploadScratchcardImage']['tmp_name'])
51
            ) {
52
                ErrorHandler::start();
53
                $image = $game->getScratchcardImage();
54
                $image = str_replace($media_url, '', $image);
55
                unlink($path .$image);
56
                $game->setScratchcardImage(null);
57
                ErrorHandler::stop(true);
58
            }
59
60
            if ($game->getScheduleOccurrenceAuto()) {
61
                $this->scheduleOccurrences($game, $data);

src/Service/Game.php 4 locations

@@ 236-246 (lines=11) @@
233
            ErrorHandler::stop(true);
234
        }
235
236
        if (isset($data['deleteMainImage']) &&
237
            $data['deleteMainImage'] &&
238
            empty($data['uploadMainImage']['tmp_name'])
239
        ) {
240
            ErrorHandler::start();
241
            $image = $game->getMainImage();
242
            $image = str_replace($media_url, '', $image);
243
            unlink($path . $image);
244
            $game->setMainImage(null);
245
            ErrorHandler::stop(true);
246
        }
247
248
        if (! empty($data['uploadSecondImage']['tmp_name'])) {
249
            ErrorHandler::start();
@@ 259-269 (lines=11) @@
256
            ErrorHandler::stop(true);
257
        }
258
259
        if (isset($data['deleteSecondImage']) &&
260
            $data['deleteSecondImage'] &&
261
            empty($data['uploadSecondImage']['tmp_name'])
262
        ) {
263
            ErrorHandler::start();
264
            $image = $game->getSecondImage();
265
            $image = str_replace($media_url, '', $image);
266
            unlink($path . $image);
267
            $game->setSecondImage(null);
268
            ErrorHandler::stop(true);
269
        }
270
271
        if (! empty($data['uploadStylesheet']['tmp_name'])) {
272
            ErrorHandler::start();
@@ 289-299 (lines=11) @@
286
            ErrorHandler::stop(true);
287
        }
288
289
        if (isset($data['deleteFbShareImage']) &&
290
            $data['deleteFbShareImage'] &&
291
            empty($data['uploadFbShareImage']['tmp_name'])
292
        ) {
293
            ErrorHandler::start();
294
            $image = $game->getFbShareImage();
295
            $image = str_replace($media_url, '', $image);
296
            unlink($path . $image);
297
            $game->setFbShareImage(null);
298
            ErrorHandler::stop(true);
299
        }
300
301
        if (! empty($data['uploadFbPageTabImage']['tmp_name'])) {
302
            ErrorHandler::start();
@@ 318-328 (lines=11) @@
315
            ErrorHandler::stop(true);
316
        }
317
318
        if (isset($data['deleteFbPageTabImage']) &&
319
            $data['deleteFbPageTabImage'] &&
320
            empty($data['uploadFbPageTabImage']['tmp_name'])
321
        ) {
322
            ErrorHandler::start();
323
            $image = $game->getFbPageTabImage();
324
            $image = str_replace($media_url, '', $image);
325
            unlink($path . $image);
326
            $game->setFbPageTabImage(null);
327
            ErrorHandler::stop(true);
328
        }
329
330
        // Let's remove the fbPostId if there is no post to send anymore
331
        if ($data['broadcastPostFacebook'] == 0) {