Code Duplication    Length = 12-14 lines in 2 locations

src/TreeGen/DirectEliminationTreeGen.php 1 location

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

src/TreeGen/PlayOffTreeGen.php 1 location

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