Code Duplication    Length = 44-44 lines in 2 locations

src/TreeGen/PlayOffTeamTreeGen.php 1 location

@@ 9-52 (lines=44) @@
6
use Xoco70\LaravelTournaments\Models\FightersGroup;
7
use Xoco70\LaravelTournaments\Models\Team;
8
9
class PlayOffTeamTreeGen extends PlayOffTreeGen
10
{
11
    /**
12
     * get Fighter by Id.
13
     *
14
     * @param $teamId
15
     *
16
     * @return Team
17
     */
18
    protected function getFighter($teamId)
19
    {
20
        return Team::find($teamId);
21
    }
22
23
    /**
24
     * Fighter is the name for competitor or team, depending on the case.
25
     *
26
     * @return Collection
27
     */
28
    protected function getFighters()
29
    {
30
        return $this->championship->teams;
31
    }
32
33
    /**
34
     * @param FightersGroup $group
35
     * @param $fighters
36
     *
37
     * @return FightersGroup
38
     */
39
    public function syncGroup(FightersGroup $group, $fighters)
40
    {
41
        // Add all competitors to Pivot Table
42
        $group->syncTeams($fighters);
43
44
        return $group;
45
    }
46
47
    protected function createByeFighter()
48
    {
49
        return new Team();
50
    }
51
52
    protected function addFighterToGroup(FightersGroup $group, $team)
53
    {
54
        $group->teams()->attach($team->id);
55
    }

src/TreeGen/SingleEliminationTeamTreeGen.php 1 location

@@ 9-52 (lines=44) @@
6
use Xoco70\LaravelTournaments\Models\FightersGroup;
7
use Xoco70\LaravelTournaments\Models\Team;
8
9
class SingleEliminationTeamTreeGen extends SingleEliminationTreeGen
10
{
11
    /**
12
     * get Fighter by Id.
13
     *
14
     * @return Team
15
     */
16
    protected function getFighter($teamId)
17
    {
18
        return Team::find($teamId);
19
    }
20
21
    /**
22
     * Fighter is the name for competitor or team, depending on the case.
23
     *
24
     * @return Collection
25
     */
26
    protected function getFighters()
27
    {
28
        return $this->championship->teams;
29
    }
30
31
    /**
32
     * @param FightersGroup $group
33
     * @param $fighters
34
     *
35
     * @return FightersGroup
36
     */
37
    public function syncGroup(FightersGroup $group, $fighters)
38
    {
39
        // Add all competitors to Pivot Table
40
        return $group->syncTeams($fighters);
41
    }
42
43
    protected function createByeFighter()
44
    {
45
        return new Team();
46
    }
47
48
    protected function addFighterToGroup(FightersGroup $group, $team)
49
    {
50
        $group->teams()->attach($team->id);
51
    }
52
}
53