Code Duplication    Length = 17-18 lines in 2 locations

controllers/TeamController.php 2 locations

@@ 65-81 (lines=17) @@
62
        });
63
    }
64
65
    public function joinAction(Team $team, Player $me)
66
    {
67
        $this->requireLogin();
68
        if (!$me->isTeamless()) {
69
            throw new ForbiddenException("You are already a member of a team");
70
        } elseif ($team->getStatus() != 'open') {
71
            throw new ForbiddenException("This team is not accepting new members without an invitation");
72
        }
73
74
        return $this->showConfirmationForm(function () use ($team, $me) {
75
            $team->addMember($me->getId());
76
            Service::getDispatcher()->dispatch(Events::TEAM_JOIN,  new Event\TeamJoinEvent($team, $me));
77
78
            return new RedirectResponse($team->getUrl());
79
        },  "Are you sure you want to join {$team->getEscapedName()}?",
80
            "You are now a member of {$team->getName()}");
81
    }
82
83
    public function kickAction(Team $team, Player $player, Player $me)
84
    {
@@ 105-122 (lines=18) @@
102
            "Player {$player->getUsername()} has been kicked from {$team->getName()}", "Kick");
103
    }
104
105
    public function abandonAction(Team $team, Player $me)
106
    {
107
        if (!$team->isMember($me->getId())) {
108
            throw new ForbiddenException("You are not a member of that team!");
109
        }
110
111
        if ($team->getLeader()->isSameAs($me)) {
112
            throw new ForbiddenException("You can't abandon the team you are leading.");
113
        }
114
115
        return $this->showConfirmationForm(function () use ($team, $me) {
116
            $team->removeMember($me->getId());
117
            Service::getDispatcher()->dispatch(Events::TEAM_ABANDON, new Event\TeamAbandonEvent($team, $me));
118
119
            return new RedirectResponse($team->getUrl());
120
        },  "Are you sure you want to abandon {$team->getEscapedName()}?",
121
            "You have left {$team->getName()}", "Abandon");
122
    }
123
124
    public function assignLeaderAction(Team $team, Player $me, Player $player)
125
    {