Code Duplication    Length = 12-14 lines in 2 locations

src/TreeGen/PlayOffTreeGen.php 1 location

@@ 76-87 (lines=12) @@
73
     * @param int $numRounds
74
     * @param $numFightersElim
75
     */
76
    protected function pushGroups($numRounds, $numFightersElim)
77
    {
78
        for ($roundNumber = 2; $roundNumber <= $numRounds; $roundNumber++) {
79
            // From last match to first match
80
            $maxMatches = ($numFightersElim / pow(2, $roundNumber));
81
            for ($matchNumber = 1; $matchNumber <= $maxMatches; $matchNumber++) {
82
                $fighters = $this->createByeGroup(2);
83
                $group = $this->saveGroup($matchNumber, $roundNumber, null);
84
                $this->syncGroup($group, $fighters);
85
            }
86
        }
87
    }
88
89
    /**
90
     * Return number of rounds for the tree based on fighter count.

src/TreeGen/SingleEliminationTreeGen.php 1 location

@@ 35-48 (lines=14) @@
32
     * @param int $numRounds
33
     * @param int $numFighters
34
     */
35
    protected function pushGroups($numRounds, $numFighters)
36
    {
37
        // TODO Here is where you should change when enable several winners for preliminary
38
        for ($roundNumber = 2; $roundNumber <= $numRounds + 1; $roundNumber++) {
39
            // From last match to first match
40
            $maxMatches = ($numFighters / pow(2, $roundNumber));
41
42
            for ($matchNumber = 1; $matchNumber <= $maxMatches; $matchNumber++) {
43
                $fighters = $this->createByeGroup(2);
44
                $group = $this->saveGroup($matchNumber, $roundNumber, null);
45
                $this->syncGroup($group, $fighters);
46
            }
47
        }
48
    }
49
50
    /**
51
     * Create empty groups for direct Elimination Tree.