@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | $prefix = "singleElimination"; |
3 | -if ($championship->hasPreliminary() && $roundNumber ==1){ |
|
3 | +if ($championship->hasPreliminary() && $roundNumber == 1) { |
|
4 | 4 | $prefix = "preliminary"; |
5 | 5 | } |
6 | -$className = $prefix."_select"; |
|
7 | -$selectName = $prefix."_fighters[]"; |
|
6 | +$className = $prefix . "_select"; |
|
7 | +$selectName = $prefix . "_fighters[]"; |
|
8 | 8 | |
9 | 9 | ?> |
10 | 10 | <!-- r = round, m = match, f = fighter --> |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param Request $request |
39 | 39 | * |
40 | - * @return \Illuminate\Http\Response|string |
|
40 | + * @return \Illuminate\Http\RedirectResponse |
|
41 | 41 | */ |
42 | 42 | public function store(Request $request, $championshipId) |
43 | 43 | { |
@@ -137,6 +137,9 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | |
140 | + /** |
|
141 | + * @param integer $numFighter |
|
142 | + */ |
|
140 | 143 | function getWinnerId($fighters, $scores, $numFighter) |
141 | 144 | { |
142 | 145 | return $scores[$numFighter] != null ? $fighters[$numFighter] : null; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | abstract protected function createByeFighter(); |
25 | 25 | |
26 | - abstract protected function addFighterToGroup(FightersGroup $group, $fighter,$fighterToUpdate); |
|
26 | + abstract protected function addFighterToGroup(FightersGroup $group, $fighter, $fighterToUpdate); |
|
27 | 27 | |
28 | 28 | abstract protected function getByeGroup($fighters); |
29 | 29 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | private function getMaxFightersByEntity($userGroups): int |
76 | 76 | { |
77 | 77 | return $userGroups |
78 | - ->sortByDesc(function ($group) { |
|
78 | + ->sortByDesc(function($group) { |
|
79 | 79 | return $group->count(); |
80 | 80 | }) |
81 | 81 | ->first() |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | protected function getTreeSize($fighterCount, $groupSize) |
114 | 114 | { |
115 | 115 | $squareMultiplied = collect([1, 2, 4, 8, 16, 32, 64]) |
116 | - ->map(function ($item) use ($groupSize) { |
|
116 | + ->map(function($item) use ($groupSize) { |
|
117 | 117 | return $item * $groupSize; |
118 | 118 | }); // [4, 8, 16, 32, 64,...] |
119 | 119 |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | { |
29 | 29 | parent::boot(); |
30 | 30 | |
31 | - static::deleting(function ($championship) { |
|
31 | + static::deleting(function($championship) { |
|
32 | 32 | $championship->competitors()->delete(); |
33 | 33 | $championship->settings()->delete(); |
34 | 34 | }); |
35 | - static::restoring(function ($championship) { |
|
35 | + static::restoring(function($championship) { |
|
36 | 36 | $championship->competitors()->restore(); |
37 | 37 | $championship->settings()->restore(); |
38 | 38 | }); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function fights() |
158 | 158 | { |
159 | - return $this->hasManyThrough(Fight::class, FightersGroup::class)->orderBy('id','asc'); |
|
159 | + return $this->hasManyThrough(Fight::class, FightersGroup::class)->orderBy('id', 'asc'); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $ageCategoryText = $this->category->getAgeString(); |
196 | 196 | $gradeText = $this->category->getGradeString(); |
197 | 197 | |
198 | - return $teamText.' '.$genders[$this->category->gender].' '.$ageCategoryText.' '.$gradeText; |
|
198 | + return $teamText . ' ' . $genders[$this->category->gender] . ' ' . $ageCategoryText . ' ' . $gradeText; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | public function getSettings() |
@@ -195,14 +195,14 @@ |
||
195 | 195 | */ |
196 | 196 | public function getValueToUpdate() |
197 | 197 | { |
198 | - try{ |
|
198 | + try { |
|
199 | 199 | if ($this->championship->category->isTeam()) { |
200 | 200 | return $this->teams->map->id[0]; |
201 | 201 | } |
202 | 202 | |
203 | 203 | return $this->competitors->map->id[0]; |
204 | 204 | |
205 | - }catch (ErrorException $e){ |
|
205 | + } catch (ErrorException $e) { |
|
206 | 206 | return null; |
207 | 207 | } |
208 | 208 |
@@ -202,7 +202,7 @@ |
||
202 | 202 | |
203 | 203 | return $this->competitors->map->id[0]; |
204 | 204 | |
205 | - }catch (ErrorException $e){ |
|
205 | + } catch (ErrorException $e){ |
|
206 | 206 | return null; |
207 | 207 | } |
208 | 208 |