Code Duplication    Length = 12-14 lines in 2 locations

src/TreeGen/PlayOffTreeGen.php 1 location

@@ 64-75 (lines=12) @@
61
     * @param int $numRounds
62
     * @param $numFightersElim
63
     */
64
    protected function pushGroups($numRounds, $numFightersElim)
65
    {
66
        for ($roundNumber = 2; $roundNumber <= $numRounds; $roundNumber++) {
67
            // From last match to first match
68
            $maxMatches = ($numFightersElim / pow(2, $roundNumber));
69
            for ($matchNumber = 1; $matchNumber <= $maxMatches; $matchNumber++) {
70
                $fighters = $this->createByeGroup(2);
71
                $group = $this->saveGroup($matchNumber, $roundNumber, null);
72
                $this->syncGroup($group, $fighters);
73
            }
74
        }
75
    }
76
77
    /**
78
     * Return number of rounds for the tree based on fighter count.

src/TreeGen/SingleEliminationTreeGen.php 1 location

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