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/DirectEliminationTreeGen.php 1 location

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