Code Duplication    Length = 24-24 lines in 2 locations

src/PlaygroundGame/Controller/Admin/InstantWinController.php 1 location

@@ 282-305 (lines=24) @@
279
    }
280
281
282
    public function removeOccurrenceAction()
283
    {
284
        $service = $this->getAdminGameService();
285
        $occurrenceId = $this->getEvent()->getRouteMatch()->getParam('occurrenceId');
286
        if (!$occurrenceId) {
287
            return $this->redirect()->toRoute('admin/playgroundgame/list');
288
        }
289
        $occurrence   = $service->getInstantWinOccurrenceMapper()->findById($occurrenceId);
290
        $instantwinId = $occurrence->getInstantWin()->getId();
291
292
        if ($occurrence->getActive()) {
293
            $service->getInstantWinOccurrenceMapper()->remove($occurrence);
294
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The occurrence was deleted');
295
        } else {
296
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage(
297
                'Il y a un participant à cet instant gagnant. Vous ne pouvez plus le supprimer'
298
            );
299
        }
300
301
        return $this->redirect()->toRoute(
302
            'admin/playgroundgame/instantwin-occurrence-list',
303
            array('gameId'=>$instantwinId)
304
        );
305
    }
306
307
    public function exportOccurrencesAction()
308
    {

src/PlaygroundGame/Controller/Admin/TradingCardController.php 1 location

@@ 255-278 (lines=24) @@
252
        );
253
    }
254
255
    public function removeOccurrenceAction()
256
    {
257
        $service = $this->getAdminGameService();
258
        $modelId = $this->getEvent()->getRouteMatch()->getParam('modelId');
259
        if (!$modelId) {
260
            return $this->redirect()->toRoute('admin/playgroundgame/list');
261
        }
262
        $model   = $service->getTradingCardModelMapper()->findById($modelId);
263
        $tradingcardId = $model->getTradingCard()->getId();
264
265
        if ($model->getActive()) {
266
            $service->getTradingCardModelMapper()->remove($model);
267
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The model has been deleted');
268
        } else {
269
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage(
270
                'cards have already been created with this model'
271
            );
272
        }
273
274
        return $this->redirect()->toRoute(
275
            'admin/playgroundgame/tradingcard-model-list',
276
            array('gameId'=>$tradingcardId)
277
        );
278
    }
279
280
    public function getAdminGameService()
281
    {