@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace App\Http\Controllers\API; |
4 | 4 | |
5 | -use App\Http\Requests\Tournament\RemoveTeam; |
|
6 | 5 | use App\League; |
7 | 6 | use App\Team; |
8 | 7 | use App\TournamentTeam; |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace App\Http\Controllers\API; |
4 | 4 | |
5 | 5 | use App\Http\Requests\Team\AssignTeamMember; |
6 | -use App\Http\Requests\Team\RemoveTeamMember; |
|
7 | 6 | use App\Member; |
8 | 7 | use App\TeamMember; |
9 | 8 | use App\Transformers\TeamMemberSearchTransformer; |
@@ -135,8 +135,8 @@ |
||
135 | 135 | $tournamentId = Input::get('tournamentId'); |
136 | 136 | $collection = Member::with(['teamMembers', 'tournamentTeams'])->get(); |
137 | 137 | |
138 | - $collection = $collection->filter(function ($member) use ($tournamentId) { |
|
139 | - $team = $member->tournamentTeams->first(function ($tournamentTeam) use ($tournamentId) { |
|
138 | + $collection = $collection->filter(function($member) use ($tournamentId) { |
|
139 | + $team = $member->tournamentTeams->first(function($tournamentTeam) use ($tournamentId) { |
|
140 | 140 | return $tournamentTeam->tournamentId == $tournamentId; |
141 | 141 | }); |
142 | 142 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | /** |
28 | 28 | * Store a newly created resource in storage. |
29 | 29 | * |
30 | - * @return Response |
|
30 | + * @return \Illuminate\Http\RedirectResponse |
|
31 | 31 | */ |
32 | 32 | public function store() |
33 | 33 | { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
68 | - * @param $match |
|
68 | + * @param Match $match |
|
69 | 69 | * @param $tournament |
70 | 70 | * @return bool |
71 | 71 | */ |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | - * @param $match |
|
89 | + * @param Match $match |
|
90 | 90 | * @param $tournament Tournament |
91 | 91 | * @return bool |
92 | 92 | */ |
@@ -43,13 +43,13 @@ |
||
43 | 43 | $match = Match::findOrFail($matchId)->replicate(); |
44 | 44 | $tournament = $match->tournament()->get()->first(); |
45 | 45 | |
46 | - Validator::extend('round_active', function ($attribute, $value, $parameters) use ($match, $tournament) { |
|
46 | + Validator::extend('round_active', function($attribute, $value, $parameters) use ($match, $tournament) { |
|
47 | 47 | return $this->isRoundActive($match, $tournament); |
48 | 48 | }); |
49 | 49 | |
50 | 50 | Validator::extend( |
51 | 51 | 'round_finished_for_pair', |
52 | - function ($attribute, $value, $parameters) use ($match, $tournament) { |
|
52 | + function($attribute, $value, $parameters) use ($match, $tournament) { |
|
53 | 53 | $match->status = $value; |
54 | 54 | return $this->isRoundFinishedForPair($match, $tournament); |
55 | 55 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | protected $round; |
30 | 30 | |
31 | 31 | /** |
32 | - * @return array |
|
32 | + * @return integer[] |
|
33 | 33 | */ |
34 | 34 | private static function listOfAvailableTeamsAmount() |
35 | 35 | { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | /** |
133 | 133 | * @name savePairs |
134 | - * @param $pairs |
|
134 | + * @param Collection $pairs |
|
135 | 135 | * @param string $gameType |
136 | 136 | */ |
137 | 137 | protected function savePairs($pairs, $gameType = Match::GAME_TYPE_QUALIFY) |
@@ -112,18 +112,18 @@ |
||
112 | 112 | |
113 | 113 | return $this->teams->chunk(2); |
114 | 114 | } else { |
115 | - $currentPairs = $tournament->getPairs()->filter(function ($pair) use ($round) { |
|
115 | + $currentPairs = $tournament->getPairs()->filter(function($pair) use ($round) { |
|
116 | 116 | return $pair->get('round') === $round - 1; |
117 | 117 | }); |
118 | 118 | |
119 | 119 | $roundWinners = new Collection(); |
120 | 120 | |
121 | - $currentPairs->each(function ($pair) use ($tournament, $roundWinners) { |
|
121 | + $currentPairs->each(function($pair) use ($tournament, $roundWinners) { |
|
122 | 122 | // detect pair winner |
123 | 123 | $roundWinners->push($tournament->getScore($pair->get('matches'))->first()); |
124 | 124 | }); |
125 | 125 | |
126 | - return $this->teams->filter(function ($team) use ($roundWinners) { |
|
126 | + return $this->teams->filter(function($team) use ($roundWinners) { |
|
127 | 127 | return $roundWinners->pluck('teamId')->contains($team['id']); |
128 | 128 | })->chunk(2); |
129 | 129 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | - * @return array |
|
59 | + * @return string[] |
|
60 | 60 | */ |
61 | 61 | public static function getAvailableMembersType() |
62 | 62 | { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
70 | - * @return array |
|
70 | + * @return string[] |
|
71 | 71 | */ |
72 | 72 | public static function getAvailableTypes() |
73 | 73 | { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | - * @return array |
|
82 | + * @return string[] |
|
83 | 83 | */ |
84 | 84 | public static function getAvailableStatuses() |
85 | 85 | { |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | // get pairs of current round matches |
101 | 101 | $pairs = new Collection(); |
102 | 102 | |
103 | - $this->matches->map(function ($match) use ($pairs) { |
|
103 | + $this->matches->map(function($match) use ($pairs) { |
|
104 | 104 | |
105 | 105 | $pairId = [$match->homeTournamentTeam->id, $match->awayTournamentTeam->id]; |
106 | 106 | sort($pairId); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | { |
180 | 180 | $score = new Collection(); |
181 | 181 | |
182 | - $matches->map(function ($match) use ($score) { |
|
182 | + $matches->map(function($match) use ($score) { |
|
183 | 183 | |
184 | 184 | $homeTeam = $score->pull($match->homeTournamentTeam->id); |
185 | 185 | $awayTeam = $score->pull($match->awayTournamentTeam->id); |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | ); |
217 | 217 | } |
218 | 218 | |
219 | - $teams =$this->matchScore($match, $homeTeam, $awayTeam); |
|
219 | + $teams = $this->matchScore($match, $homeTeam, $awayTeam); |
|
220 | 220 | $score->put($match->homeTournamentTeam->id, $teams['homeTeam']); |
221 | 221 | $score->put($match->awayTournamentTeam->id, $teams['awayTeam']); |
222 | 222 | }); |
223 | 223 | |
224 | 224 | // sort by points and goal difference |
225 | - $score = $score->sort(function ($a, $b) { |
|
225 | + $score = $score->sort(function($a, $b) { |
|
226 | 226 | if ($b['points'] === $a['points']) { |
227 | 227 | return $b['goalsDifference'] - $a['goalsDifference']; |
228 | 228 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | $previousRow = null; |
234 | 234 | $position = 1; |
235 | - $score = $score->map(function ($row) use (&$previousRow, &$position) { |
|
235 | + $score = $score->map(function($row) use (&$previousRow, &$position) { |
|
236 | 236 | if ($previousRow |
237 | 237 | && $previousRow['points'] > 0 |
238 | 238 | && $previousRow['points'] == $row['points'] |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | }); |
253 | 253 | |
254 | 254 | // alphabetical sort for teams on the same position |
255 | - $score = $score->sortBy(function ($team) { |
|
255 | + $score = $score->sortBy(function($team) { |
|
256 | 256 | return $team['position'] . '-' . $team['name']; |
257 | 257 | }, SORT_NUMERIC); |
258 | 258 |
@@ -60,7 +60,7 @@ |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | if ($teamId) { |
63 | - $collection->where(function ($query) use ($teamId) { |
|
63 | + $collection->where(function($query) use ($teamId) { |
|
64 | 64 | $query->where('homeTournamentTeamId', $teamId) |
65 | 65 | ->orWhere('awayTournamentTeamId', $teamId); |
66 | 66 | }); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | $matches = $matches->sortBy('id'); |
24 | 24 | |
25 | - $matches->map(function ($match) use ($standings) { |
|
25 | + $matches->map(function($match) use ($standings) { |
|
26 | 26 | |
27 | 27 | $pairId = [$match->homeTournamentTeam->id, $match->awayTournamentTeam->id]; |
28 | 28 | sort($pairId); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | Route::group([ |
64 | 64 | 'middleware' => 'web', |
65 | 65 | 'namespace' => $this->namespace, |
66 | - ], function () { |
|
66 | + ], function() { |
|
67 | 67 | require base_path('routes/web.php'); |
68 | 68 | }); |
69 | 69 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | 'middleware' => 'api', |
82 | 82 | 'namespace' => $this->namespace, |
83 | 83 | 'prefix' => 'api', |
84 | - ], function () { |
|
84 | + ], function() { |
|
85 | 85 | require base_path('routes/api.php'); |
86 | 86 | }); |
87 | 87 | } |