@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use Illuminate\Support\Facades\App; |
| 7 | 7 | use Xoco70\KendoTournaments\Models\Championship; |
| 8 | 8 | use Xoco70\KendoTournaments\Models\DirectEliminationFight; |
| 9 | -use Xoco70\KendoTournaments\Models\Fight; |
|
| 10 | 9 | use Xoco70\KendoTournaments\Models\PreliminaryFight; |
| 11 | 10 | |
| 12 | 11 | class PlayOffTreeGen extends TreeGen |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | protected function pushGroups($numRounds, $numFightersElim) |
| 38 | 38 | { |
| 39 | 39 | // TODO Here is where you should change when enable several winners for preliminary |
| 40 | - for ($roundNumber = 2; $roundNumber <= $numRounds +1; $roundNumber++) { |
|
| 40 | + for ($roundNumber = 2; $roundNumber <= $numRounds + 1; $roundNumber++) { |
|
| 41 | 41 | // From last match to first match |
| 42 | 42 | $maxMatches = ($numFightersElim / pow(2, $roundNumber)); |
| 43 | 43 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $numFightersElim = $numFighters / $this->championship->getSettings()->preliminaryGroupSize * 2; |
| 58 | 58 | // We calculate how much rounds we will have |
| 59 | - $numRounds = intval(log($numFightersElim, 2)) ; // 3 rounds, but begining from round 2 ( ie => 4) |
|
| 59 | + $numRounds = intval(log($numFightersElim, 2)); // 3 rounds, but begining from round 2 ( ie => 4) |
|
| 60 | 60 | $this->pushGroups($numRounds, $numFightersElim); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | public function generateNextRoundsFights() |
| 105 | 105 | { |
| 106 | 106 | $fight = new DirectEliminationFight; |
| 107 | - $fight->saveFights($this->championship,2); |
|
| 107 | + $fight->saveFights($this->championship, 2); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @param $numFighters |
| 113 | 113 | * @return int |
| 114 | 114 | */ |
| 115 | - public function getNumRounds($numFighters){ |
|
| 115 | + public function getNumRounds($numFighters) { |
|
| 116 | 116 | return intval(log($numFighters / $this->championship->getSettings()->preliminaryGroupSize * 2, 2)); |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Get the biggest entity group |
| 55 | - * @param $userGroups |
|
| 55 | + * @param Collection $userGroups |
|
| 56 | 56 | * |
| 57 | 57 | * @return int |
| 58 | 58 | */ |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * Repart BYE in the tree, |
| 114 | - * @param $fighterGroups |
|
| 114 | + * @param Collection $fighterGroups |
|
| 115 | 115 | * @param int $max |
| 116 | 116 | * |
| 117 | 117 | * @return Collection |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
| 182 | - * @param $area |
|
| 183 | - * @param $order |
|
| 184 | - * @param $round |
|
| 182 | + * @param integer $area |
|
| 183 | + * @param integer $order |
|
| 184 | + * @param integer $round |
|
| 185 | 185 | * @param $parent |
| 186 | 186 | * @return FightersGroup |
| 187 | 187 | */ |
@@ -326,8 +326,8 @@ discard block |
||
| 326 | 326 | |
| 327 | 327 | /** |
| 328 | 328 | * @param Collection $fighters |
| 329 | - * @param $frequency |
|
| 330 | - * @param $sizeGroupBy |
|
| 329 | + * @param integer $frequency |
|
| 330 | + * @param integer $sizeGroupBy |
|
| 331 | 331 | * @param $bye |
| 332 | 332 | * @return Collection |
| 333 | 333 | */ |
@@ -350,8 +350,8 @@ discard block |
||
| 350 | 350 | /** |
| 351 | 351 | * @param $frequency |
| 352 | 352 | * @param $sizeGroupBy |
| 353 | - * @param $count |
|
| 354 | - * @param $byeCount |
|
| 353 | + * @param integer $count |
|
| 354 | + * @param integer $byeCount |
|
| 355 | 355 | * @return bool |
| 356 | 356 | */ |
| 357 | 357 | private function shouldInsertBye($frequency, $sizeGroupBy, $count, $byeCount): bool |
@@ -361,7 +361,6 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | |
| 363 | 363 | /** |
| 364 | - * @param Championship $championship |
|
| 365 | 364 | */ |
| 366 | 365 | protected function destroyPreviousFights() |
| 367 | 366 | { |
@@ -190,7 +190,7 @@ |
||
| 190 | 190 | * @param $numFighters |
| 191 | 191 | * @return int |
| 192 | 192 | */ |
| 193 | - public function getNumRounds($numFighters){ |
|
| 193 | + public function getNumRounds($numFighters) { |
|
| 194 | 194 | return intval(log($numFighters, 2)); |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | parent::boot(); |
| 31 | 31 | |
| 32 | - static::deleting(function ($championship) { |
|
| 32 | + static::deleting(function($championship) { |
|
| 33 | 33 | $championship->competitors()->delete(); |
| 34 | 34 | $championship->settings()->delete(); |
| 35 | 35 | }); |
| 36 | - static::restoring(function ($championship) { |
|
| 36 | + static::restoring(function($championship) { |
|
| 37 | 37 | $championship->competitors()->restore(); |
| 38 | 38 | $championship->settings()->restore(); |
| 39 | 39 | }); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | public function groupsFromRound($round) |
| 220 | 220 | { |
| 221 | - return $this->fightersGroups()->where('round','>=', $round); |
|
| 221 | + return $this->fightersGroups()->where('round', '>=', $round); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |