@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | use Xoco70\KendoTournaments\TreeGen\DirectEliminationTreeGen; |
3 | 3 | |
4 | -$directEliminationTree = $championship->fightersGroups->where('round',1)->map(function ($item, $key) use ($championship) { |
|
5 | - if ($championship->category->isTeam()){ |
|
4 | +$directEliminationTree = $championship->fightersGroups->where('round', 1)->map(function($item, $key) use ($championship) { |
|
5 | + if ($championship->category->isTeam()) { |
|
6 | 6 | |
7 | 7 | $fighter1 = $item->team1 != null ? $item->team1->name : "Bye"; |
8 | 8 | $fighter2 = $item->team2 != null ? $item->team2->name : "Bye"; |
9 | - }else{ |
|
9 | + } else { |
|
10 | 10 | $fighter1 = $item->competitors->get(0) != null ? $item->competitors->get(0)->user->name : "Bye"; |
11 | 11 | $fighter2 = $item->competitors->get(1) != null ? $item->competitors->get(1)->user->name : "Bye"; |
12 | 12 |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | $fighter1 = $item->team1 != null ? $item->team1->name : "Bye"; |
8 | 8 | $fighter2 = $item->team2 != null ? $item->team2->name : "Bye"; |
9 | - }else{ |
|
9 | + } else{ |
|
10 | 10 | $fighter1 = $item->competitors->get(0) != null ? $item->competitors->get(0)->user->name : "Bye"; |
11 | 11 | $fighter2 = $item->competitors->get(1) != null ? $item->competitors->get(1)->user->name : "Bye"; |
12 | 12 |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | private function getTreeSize($fighterCount, $groupSize) |
156 | 156 | { |
157 | 157 | $square = collect([1, 2, 4, 8, 16, 32, 64]); |
158 | - $squareMultiplied = $square->map(function ($item, $key) use ($groupSize) { |
|
158 | + $squareMultiplied = $square->map(function($item, $key) use ($groupSize) { |
|
159 | 159 | return $item * $groupSize; |
160 | 160 | }); |
161 | 161 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | // Chunking to make small round robin groups |
265 | 265 | if ($this->championship->hasPreliminary()) { |
266 | 266 | $fightersGroup = $fightersByEntity->chunk($this->settings->preliminaryGroupSize)->shuffle(); |
267 | - } elseif ($this->championship->isDirectEliminationType() || $round>1) { |
|
267 | + } elseif ($this->championship->isDirectEliminationType() || $round > 1) { |
|
268 | 268 | $fightersGroup = $fightersByEntity->chunk(2)->shuffle(); |
269 | 269 | } else { // Round Robin |
270 | 270 | $fightersGroup = $fightersByEntity->chunk($fightersByEntity->count()); |
@@ -56,7 +56,9 @@ |
||
56 | 56 | $matches = array_chunk($teams, 2); |
57 | 57 | |
58 | 58 | //If there's already a match in the match array, then that means the next round is round 2, so increase the round number |
59 | - if (count($this->brackets)) $roundNumber++; |
|
59 | + if (count($this->brackets)) { |
|
60 | + $roundNumber++; |
|
61 | + } |
|
60 | 62 | |
61 | 63 | $countMatches = count($matches); |
62 | 64 | //Create the first full round of teams, some may be blank if waiting on the results of a previous round |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | if ($championship->category->isTeam) { |
36 | 36 | $fighters = $group->teams; |
37 | - if (sizeof($fighters) == 0){ |
|
37 | + if (sizeof($fighters) == 0) { |
|
38 | 38 | $fighters->push(new Team()); |
39 | 39 | $fighters->push(new Team()); |
40 | 40 | } else if (count($fighters) % 2 != 0) { |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | |
44 | 44 | } else { |
45 | 45 | $fighters = $group->competitors; |
46 | - if (sizeof($fighters) == 0){ // If |
|
46 | + if (sizeof($fighters) == 0) { // If |
|
47 | 47 | $fighters->push(new Competitor()); |
48 | 48 | $fighters->push(new Competitor()); |
49 | - }else if (count($fighters) % 2 != 0) { // If fighter is not pair, add a BYE |
|
49 | + } else if (count($fighters) % 2 != 0) { // If fighter is not pair, add a BYE |
|
50 | 50 | $fighters->push(new Competitor()); |
51 | 51 | } |
52 | 52 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | if (sizeof($fighters) == 0){ // If |
47 | 47 | $fighters->push(new Competitor()); |
48 | 48 | $fighters->push(new Competitor()); |
49 | - }else if (count($fighters) % 2 != 0) { // If fighter is not pair, add a BYE |
|
49 | + } else if (count($fighters) % 2 != 0) { // If fighter is not pair, add a BYE |
|
50 | 50 | $fighters->push(new Competitor()); |
51 | 51 | } |
52 | 52 |