Code Duplication    Length = 21-21 lines in 2 locations

src/Controller/Admin/InstantWinController.php 1 location

@@ 279-299 (lines=21) @@
276
        return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/instantwin-occurrence-list', array('gameId'=>$this->game->getId())));
277
    }
278
279
    public function removeOccurrenceAction()
280
    {
281
        $service = $this->getAdminGameService();
282
        $occurrenceId = $this->getEvent()->getRouteMatch()->getParam('occurrenceId');
283
        if (!$occurrenceId) {
284
            return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list'));
285
        }
286
        $occurrence   = $service->getInstantWinOccurrenceMapper()->findById($occurrenceId);
287
        $instantwinId = $occurrence->getInstantWin()->getId();
288
289
        if ($occurrence->getActive()) {
290
            $service->getInstantWinOccurrenceMapper()->remove($occurrence);
291
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The occurrence has been deleted');
292
        } else {
293
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage(
294
                "A player has already won this occurrence. You can't delete it anymore"
295
            );
296
        }
297
298
        return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/instantwin-occurrence-list', array('gameId'=>$instantwinId)));
299
    }
300
301
    public function exportOccurrencesAction()
302
    {

src/Controller/Admin/TradingCardController.php 1 location

@@ 248-268 (lines=21) @@
245
        );
246
    }
247
248
    public function removeOccurrenceAction()
249
    {
250
        $service = $this->getAdminGameService();
251
        $modelId = $this->getEvent()->getRouteMatch()->getParam('modelId');
252
        if (!$modelId) {
253
            return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list'));
254
        }
255
        $model         = $service->getTradingCardModelMapper()->findById($modelId);
256
        $tradingcardId = $model->getTradingCard()->getId();
257
258
        if ($model->getActive()) {
259
            $service->getTradingCardModelMapper()->remove($model);
260
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The model has been deleted');
261
        } else {
262
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage(
263
                'cards have already been created with this model'
264
            );
265
        }
266
267
        return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/tradingcard-model-list', array('gameId' => $tradingcardId)));
268
    }
269
270
    public function getAdminGameService()
271
    {