@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * @param $request |
| 30 | - * @param $listener |
|
| 30 | + * @param Http\Controllers\Auth\LoginController $listener |
|
| 31 | 31 | * @param $provider |
| 32 | 32 | * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Symfony\Component\HttpFoundation\RedirectResponse |
| 33 | 33 | */ |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | - * @param $ageCategoryText |
|
| 88 | + * @param string $ageCategoryText |
|
| 89 | 89 | * @return string |
| 90 | 90 | */ |
| 91 | 91 | protected function hasAgeMinAndMax($ageCategoryText): string |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * @param $grades |
| 126 | - * @param $gradeText |
|
| 126 | + * @param string $gradeText |
|
| 127 | 127 | * @return string |
| 128 | 128 | */ |
| 129 | 129 | protected function hasGradeMinAndMax($grades, $gradeText): string |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * @param $newfile |
|
| 65 | - * @param $savepath |
|
| 64 | + * @param string $newfile |
|
| 65 | + * @param string $savepath |
|
| 66 | 66 | */ |
| 67 | 67 | protected function unzipTranslations($newfile, $savepath) |
| 68 | 68 | { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * Delete a folder and his content |
| 84 | - * @param $dir |
|
| 84 | + * @param string $dir |
|
| 85 | 85 | */ |
| 86 | 86 | private function rmdir_recursive($dir) |
| 87 | 87 | { |
@@ -86,9 +86,14 @@ |
||
| 86 | 86 | private function rmdir_recursive($dir) |
| 87 | 87 | { |
| 88 | 88 | foreach (scandir($dir) as $file) { |
| 89 | - if ('.' === $file || '..' === $file) continue; |
|
| 90 | - if (is_dir("$dir/$file")) $this->rmdir_recursive("$dir/$file"); |
|
| 91 | - else unlink("$dir/$file"); |
|
| 89 | + if ('.' === $file || '..' === $file) { |
|
| 90 | + continue; |
|
| 91 | + } |
|
| 92 | + if (is_dir("$dir/$file")) { |
|
| 93 | + $this->rmdir_recursive("$dir/$file"); |
|
| 94 | + } else { |
|
| 95 | + unlink("$dir/$file"); |
|
| 96 | + } |
|
| 92 | 97 | } |
| 93 | 98 | rmdir($dir); |
| 94 | 99 | } |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | { |
| 7 | 7 | /** |
| 8 | 8 | * Get tournament with a lot of stuff Inside - Should Change name |
| 9 | - * @param $request |
|
| 9 | + * @param \Illuminate\Http\Request $request |
|
| 10 | 10 | * @return \Illuminate\Database\Eloquent\Builder |
| 11 | 11 | */ |
| 12 | 12 | public static function getTournament($request) |
@@ -14,27 +14,27 @@ |
||
| 14 | 14 | $tournament = null; |
| 15 | 15 | if (FightersGroup::hasTournamentInRequest($request)) { |
| 16 | 16 | $tournamentSlug = $request->tournament; |
| 17 | - $tournament = Tournament::with(['championships' => function ($query) use ($request) { |
|
| 17 | + $tournament = Tournament::with(['championships' => function($query) use ($request) { |
|
| 18 | 18 | $query->with([ |
| 19 | 19 | 'settings', |
| 20 | 20 | 'category', |
| 21 | 21 | 'users', |
| 22 | - 'fightersGroups' => function ($query) { |
|
| 22 | + 'fightersGroups' => function($query) { |
|
| 23 | 23 | return $query->with('teams', 'competitors', 'fights'); |
| 24 | 24 | }]); |
| 25 | 25 | }])->withCount('competitors', 'teams') |
| 26 | 26 | ->where('slug', $tournamentSlug)->firstOrFail(); |
| 27 | 27 | } elseif (FightersGroup::hasChampionshipInRequest($request)) { |
| 28 | - $tournament = Tournament::whereHas('championships', function ($query) use ($request) { |
|
| 28 | + $tournament = Tournament::whereHas('championships', function($query) use ($request) { |
|
| 29 | 29 | return $query->where('id', $request->championshipId); |
| 30 | 30 | }) |
| 31 | - ->with(['championships' => function ($query) use ($request) { |
|
| 31 | + ->with(['championships' => function($query) use ($request) { |
|
| 32 | 32 | $query->where('id', '=', $request->championshipId) |
| 33 | 33 | ->with([ |
| 34 | 34 | 'settings', |
| 35 | 35 | 'category', |
| 36 | 36 | 'users', |
| 37 | - 'fightersGroups' => function ($query) { |
|
| 37 | + 'fightersGroups' => function($query) { |
|
| 38 | 38 | return $query->with('teams', 'competitors', 'fights'); |
| 39 | 39 | }]); |
| 40 | 40 | }]) |
@@ -124,7 +124,7 @@ |
||
| 124 | 124 | /** |
| 125 | 125 | * Update the specified resource in storage. |
| 126 | 126 | * |
| 127 | - * @param AssociationRequest|Request $request |
|
| 127 | + * @param AssociationRequest $request |
|
| 128 | 128 | * @param int $id |
| 129 | 129 | * @return Response|RedirectResponse |
| 130 | 130 | * @throws AuthorizationException |
@@ -62,8 +62,9 @@ discard block |
||
| 62 | 62 | public function store(AssociationRequest $request) |
| 63 | 63 | { |
| 64 | 64 | try { |
| 65 | - if ($request->president_id == 0) |
|
| 66 | - $request->merge(['president_id' => null]); |
|
| 65 | + if ($request->president_id == 0) { |
|
| 66 | + $request->merge(['president_id' => null]); |
|
| 67 | + } |
|
| 67 | 68 | |
| 68 | 69 | $association = Association::create($request->all()); |
| 69 | 70 | if (Request::ajax()) { |
@@ -137,8 +138,9 @@ discard block |
||
| 137 | 138 | throw new AuthorizationException(); |
| 138 | 139 | } |
| 139 | 140 | try { |
| 140 | - if ($request->president_id == 0) |
|
| 141 | - $request->merge(['president_id' => null]); |
|
| 141 | + if ($request->president_id == 0) { |
|
| 142 | + $request->merge(['president_id' => null]); |
|
| 143 | + } |
|
| 142 | 144 | |
| 143 | 145 | $association->update($request->all()); |
| 144 | 146 | $msg = trans('msg.association_edit_successful', ['name' => $association->name]); |
@@ -67,6 +67,7 @@ |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | + * @param string $folder |
|
| 70 | 71 | * @return int |
| 71 | 72 | */ |
| 72 | 73 | protected function getLangWordsCount($folder): int |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * Handle a registration request for the application. |
| 90 | 90 | * |
| 91 | 91 | * @param AuthRequest $request |
| 92 | - * @return bool |
|
| 92 | + * @return \Illuminate\Http\RedirectResponse |
|
| 93 | 93 | */ |
| 94 | 94 | public function register(AuthRequest $request) |
| 95 | 95 | { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * Confirm a user's email address. |
| 122 | 122 | * |
| 123 | 123 | * @param string $token |
| 124 | - * @return mixed |
|
| 124 | + * @return \Illuminate\Http\RedirectResponse |
|
| 125 | 125 | */ |
| 126 | 126 | public function confirmEmail($token) |
| 127 | 127 | { |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | * |
| 65 | 65 | * @param Tournament $tournament |
| 66 | 66 | * @param ChampionshipRequest $request |
| 67 | - * @return \Illuminate\Http\Response |
|
| 67 | + * @return \Illuminate\Http\RedirectResponse |
|
| 68 | 68 | */ |
| 69 | 69 | public function store(Tournament $tournament, ChampionshipRequest $request) |
| 70 | 70 | { |
@@ -38,9 +38,15 @@ |
||
| 38 | 38 | $grades = Grade::getAllPlucked(); |
| 39 | 39 | $invite = Invite::getInviteFromToken($token); |
| 40 | 40 | |
| 41 | - if (is_null($invite)) throw new InvitationNeededException(); |
|
| 42 | - if ($invite->hasExpired()) throw new InvitationExpiredException(); |
|
| 43 | - if ($invite->active != 1) throw new InvitationNotActiveException(); |
|
| 41 | + if (is_null($invite)) { |
|
| 42 | + throw new InvitationNeededException(); |
|
| 43 | + } |
|
| 44 | + if ($invite->hasExpired()) { |
|
| 45 | + throw new InvitationExpiredException(); |
|
| 46 | + } |
|
| 47 | + if ($invite->active != 1) { |
|
| 48 | + throw new InvitationNotActiveException(); |
|
| 49 | + } |
|
| 44 | 50 | |
| 45 | 51 | // Check if user is already registered |
| 46 | 52 | $user = User::where('email', $invite->email)->first(); |
@@ -150,9 +150,9 @@ |
||
| 150 | 150 | /** |
| 151 | 151 | * Update the specified resource in storage. |
| 152 | 152 | * |
| 153 | - * @param ClubRequest|Request $request |
|
| 153 | + * @param ClubRequest $request |
|
| 154 | 154 | * @param int $id |
| 155 | - * @return \Illuminate\Http\Response |
|
| 155 | + * @return RedirectResponse |
|
| 156 | 156 | * @throws AuthorizationException |
| 157 | 157 | */ |
| 158 | 158 | public function update(ClubRequest $request, $id) |
@@ -88,9 +88,15 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | |
| 90 | 90 | try { |
| 91 | - if ($request->president_id == 0) $request->merge(['president_id' => null]); |
|
| 92 | - if ($request->federation_id == 0) $request->merge(['federation_id' => null]); |
|
| 93 | - if ($request->association_id == 0) $request->merge(['association_id' => null]); |
|
| 91 | + if ($request->president_id == 0) { |
|
| 92 | + $request->merge(['president_id' => null]); |
|
| 93 | + } |
|
| 94 | + if ($request->federation_id == 0) { |
|
| 95 | + $request->merge(['federation_id' => null]); |
|
| 96 | + } |
|
| 97 | + if ($request->association_id == 0) { |
|
| 98 | + $request->merge(['association_id' => null]); |
|
| 99 | + } |
|
| 94 | 100 | $club = Club::create($request->all()); |
| 95 | 101 | |
| 96 | 102 | if (Request::ajax()) { |
@@ -162,8 +168,12 @@ discard block |
||
| 162 | 168 | $this->authorize('update', [$club, Auth::user()]); |
| 163 | 169 | |
| 164 | 170 | try { |
| 165 | - if ($request->president_id == 0) $request->merge(['president_id' => null]); |
|
| 166 | - if ($request->association_id == 0) $request->merge(['association_id' => null]); |
|
| 171 | + if ($request->president_id == 0) { |
|
| 172 | + $request->merge(['president_id' => null]); |
|
| 173 | + } |
|
| 174 | + if ($request->association_id == 0) { |
|
| 175 | + $request->merge(['association_id' => null]); |
|
| 176 | + } |
|
| 167 | 177 | |
| 168 | 178 | $club->update($request->all()); |
| 169 | 179 | $msg = trans('msg.club_edit_successful', ['name' => $club->name]); |