Code Duplication    Length = 23-23 lines in 2 locations

src/Badger/Bundle/GameBundle/Controller/AdventureStepCompletionController.php 1 location

@@ 38-60 (lines=23) @@
35
     *
36
     * @return RedirectResponse
37
     */
38
    public function rejectAction($id)
39
    {
40
        $pendingCompletion = $this->get('badger.game.repository.adventure_step_completion')
41
            ->findOneBy(['id' => $id, 'pending' => 1]);
42
43
        if (null === $pendingCompletion) {
44
            throw new NotFoundHttpException(sprintf('No pending AdventureStepCompletion entity with id %s', $id));
45
        }
46
47
        $stepTitle = $pendingCompletion->getAdventureStep()->getTitle();
48
        $username = $pendingCompletion->getUser()->getUsername();
49
50
        $questCompletionRemover = $this->get('badger.game.remover.adventure_step_completion');
51
        $questCompletionRemover->remove($pendingCompletion);
52
53
        $this->addFlash('notice', sprintf(
54
            'Successfully rejected the claimed adventure step "%s" for %s!',
55
            $stepTitle,
56
            $username
57
        ));
58
59
        return $this->redirectToRoute('admin_claimed_adventure_step_index');
60
    }
61
62
    /**
63
     * Accept an adventure step completion.

src/Badger/Bundle/GameBundle/Controller/QuestCompletionController.php 1 location

@@ 38-60 (lines=23) @@
35
     *
36
     * @return RedirectResponse
37
     */
38
    public function rejectAction($id)
39
    {
40
        $pendingCompletion = $this->get('badger.game.repository.quest_completion')
41
            ->findOneBy(['id' => $id, 'pending' => 1]);
42
43
        if (null === $pendingCompletion) {
44
            throw new NotFoundHttpException(sprintf('No pending QuestCompletion entity with id %s', $id));
45
        }
46
47
        $questTitle = $pendingCompletion->getQuest()->getTitle();
48
        $username = $pendingCompletion->getUser()->getUsername();
49
50
        $questCompletionRemover = $this->get('badger.game.remover.quest_completion');
51
        $questCompletionRemover->remove($pendingCompletion);
52
53
        $this->addFlash('notice', sprintf(
54
            'Successfully rejected the claimed quest "%s" for %s!',
55
            $questTitle,
56
            $username
57
        ));
58
59
        return $this->redirectToRoute('admin_claimed_quest_index');
60
    }
61
62
    /**
63
     * Accept a quest completion.