Passed
Pull Request — master (#610)
by John
05:33
created
app/Jobs/AntiCheat.php 1 patch
Braces   +17 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,7 +57,9 @@  discard block
 block discarded – undo
57 57
         $cid=$this->cid;
58 58
         $contest=EloquentContestModel::find($cid);
59 59
 
60
-        if (!$contest->isJudgingComplete()) throw new Exception('Judging Incompleted');
60
+        if (!$contest->isJudgingComplete()) {
61
+            throw new Exception('Judging Incompleted');
62
+        }
61 63
 
62 64
         $acceptedSubmissions=$contest->submissions->whereIn('verdict', [
63 65
             'Accepted',
@@ -79,8 +81,11 @@  discard block
 block discarded – undo
79 81
                 $lang=$this->supportLang[$lang];
80 82
                 $ext=$lang;
81 83
                 Storage::put("contest/anticheat/$cid/raw/$prob/$lang/[$submission->uid][$submission->sid].$ext", $submission->solution);
82
-                if (!isset($probLangs[$prob][$lang])) $probLangs[$prob][$lang]=1;
83
-                else $probLangs[$prob][$lang]++;
84
+                if (!isset($probLangs[$prob][$lang])) {
85
+                    $probLangs[$prob][$lang]=1;
86
+                } else {
87
+                    $probLangs[$prob][$lang]++;
88
+                }
84 89
                 $totProb++;
85 90
             }
86 91
         }
@@ -148,13 +153,19 @@  discard block
 block discarded – undo
148 153
     private function afterWork($cid, $prob, $lang, $rawContent)
149 154
     {
150 155
         foreach (preg_split('~[\r\n]+~', $rawContent) as $line) {
151
-            if (blank($line) or ctype_space($line)) continue;
156
+            if (blank($line) or ctype_space($line)) {
157
+                continue;
158
+            }
152 159
             // [3057][64659].c++ consists for 100 % of [3057][64679].c++ material
153 160
             $line=explode('%', $line);
154
-            if (!isset($line[1])) continue;
161
+            if (!isset($line[1])) {
162
+                continue;
163
+            }
155 164
             [$uid1, $sid1, $percentage]=sscanf($line[0], "[%d][%d].$lang consists for %d ");
156 165
             [$uid2, $sid2]=sscanf($line[1], " of [%d][%d].$lang material");
157
-            if ($uid1==$uid2) continue;
166
+            if ($uid1==$uid2) {
167
+                continue;
168
+            }
158 169
             $username1=User::find($uid1)->name;
159 170
             $username2=User::find($uid2)->name;
160 171
             $this->retArr[]=[
Please login to merge, or discard this patch.
app/Http/Controllers/Group/IndexController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,9 @@
 block discarded – undo
96 96
         $groupModel=new GroupModel();
97 97
         $basic_info=$groupModel->details($gcode);
98 98
         $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id);
99
-        if ($clearance<1) return Redirect::route('group.detail', ['gcode' => $gcode]);
99
+        if ($clearance<1) {
100
+            return Redirect::route('group.detail', ['gcode' => $gcode]);
101
+        }
100 102
         $group_info=$groupModel->details($gcode);
101 103
         return view('group.settings.analysis', [
102 104
             'page_title'=>"Group Analysis",
Please login to merge, or discard this patch.
app/Http/Controllers/Ajax/GroupController.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -184,9 +184,13 @@
 block discarded – undo
184 184
         $all_data=$request->all();
185 185
 
186 186
         $groupModel=new OutdatedGroupModel();
187
-        if ($all_data["gcode"]=="create") return ResponseModel::err(7005);
187
+        if ($all_data["gcode"]=="create") {
188
+            return ResponseModel::err(7005);
189
+        }
188 190
         $is_group=$groupModel->isGroup($all_data["gcode"]);
189
-        if ($is_group) return ResponseModel::err(7006);
191
+        if ($is_group) {
192
+            return ResponseModel::err(7006);
193
+        }
190 194
 
191 195
         $allow_extension=['jpg', 'png', 'jpeg', 'gif', 'bmp'];
192 196
         if (!empty($request->file('img')) && $request->file('img')->isValid()) {
Please login to merge, or discard this patch.
app/Http/Controllers/Ajax/GroupManageController.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -247,11 +247,17 @@
 block discarded – undo
247 247
 
248 248
         $groupModel=new GroupModel();
249 249
         $is_user=$groupModel->isUser($all_data["email"]);
250
-        if (!$is_user) return ResponseModel::err(2006);
250
+        if (!$is_user) {
251
+            return ResponseModel::err(2006);
252
+        }
251 253
         $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id);
252
-        if ($clearance<2) return ResponseModel::err(7002);
254
+        if ($clearance<2) {
255
+            return ResponseModel::err(7002);
256
+        }
253 257
         $targetClearance=$groupModel->judgeEmailClearance($all_data["gid"], $all_data["email"]);
254
-        if ($targetClearance!=-3) return ResponseModel::err(7003);
258
+        if ($targetClearance!=-3) {
259
+            return ResponseModel::err(7003);
260
+        }
255 261
         $groupModel->inviteMember($all_data["gid"], $all_data["email"]);
256 262
         $basic=$groupModel->basic($all_data['gid']);
257 263
         $url=route('group.detail', ['gcode' => $basic['gcode']]);
Please login to merge, or discard this patch.
app/Http/Controllers/Ajax/ContestAdminController.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -326,7 +326,9 @@  discard block
 block discarded – undo
326 326
         if ($contestModel->judgeClearance($cid, Auth::user()->id)!=3) {
327 327
             return ResponseModel::err(2001);
328 328
         }
329
-        if (!is_null(Cache::tags(['contest', 'admin', 'PDFGenerate'])->get($cid))) return ResponseModel::err(8001);
329
+        if (!is_null(Cache::tags(['contest', 'admin', 'PDFGenerate'])->get($cid))) {
330
+            return ResponseModel::err(8001);
331
+        }
330 332
         $generateProcess=new GeneratePDF($cid, $config);
331 333
         dispatch($generateProcess)->onQueue('normal');
332 334
         Cache::tags(['contest', 'admin', 'PDFGenerate'])->put($cid, $generateProcess->getJobStatusId());
@@ -345,7 +347,9 @@  discard block
 block discarded – undo
345 347
         if ($contestModel->judgeClearance($cid, Auth::user()->id)!=3) {
346 348
             return ResponseModel::err(2001);
347 349
         }
348
-        if (!is_null(Cache::tags(['contest', 'admin', 'anticheat'])->get($cid))) return ResponseModel::err(8001);
350
+        if (!is_null(Cache::tags(['contest', 'admin', 'anticheat'])->get($cid))) {
351
+            return ResponseModel::err(8001);
352
+        }
349 353
         if (EloquentContestModel::find($cid)->isJudgingComplete()) {
350 354
             $anticheatProcess=new AntiCheat($cid);
351 355
             dispatch($anticheatProcess)->onQueue('normal');
Please login to merge, or discard this patch.
app/Http/Middleware/Privileged.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
                 if ($groupModel->judgeClearance($groupModel->gid($request->gcode), Auth::user()->id)>=2) {
25 25
                     return $next($request);
26 26
                 }
27
-            }elseif (isset($request->cid)) {
27
+            } elseif (isset($request->cid)) {
28 28
                 //contest privilege
29 29
                 $contestModel=new ContestModel();
30 30
                 if ($contestModel->judgeClearance($request->cid, Auth::user()->id)==3) {
Please login to merge, or discard this patch.
app/Admin/Controllers/SubmissionController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,9 @@
 block discarded – undo
103 103
             return $this->user->name;
104 104
         });
105 105
         $grid->column("contest_name", __('admin.submissions.contest_name'))->display(function() {
106
-            if (!is_null($this->contest)) return $this->contest->name;
106
+            if (!is_null($this->contest)) {
107
+                return $this->contest->name;
108
+            }
107 109
         });
108 110
         $grid->column("readable_name", __('admin.submissions.readable_name'))->display(function() {
109 111
             return $this->problem->readable_name;
Please login to merge, or discard this patch.
app/Models/RankModel.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -65,20 +65,26 @@  discard block
 block discarded – undo
65 65
 
66 66
     public static function getColor($rankTitle)
67 67
     {
68
-        if (is_null($rankTitle)) return "";
68
+        if (is_null($rankTitle)) {
69
+            return "";
70
+        }
69 71
         return self::$casualRanking[$rankTitle];
70 72
     }
71 73
 
72 74
     public static function getProfessionalColor($rankTitle)
73 75
     {
74
-        if (is_null($rankTitle)) return self::$professionalRanking["None"];
76
+        if (is_null($rankTitle)) {
77
+            return self::$professionalRanking["None"];
78
+        }
75 79
         return self::$professionalRanking[$rankTitle];
76 80
     }
77 81
 
78 82
     public function list($num)
79 83
     {
80 84
         $rankList=Cache::tags(['rank'])->get('general');
81
-        if ($rankList==null) $rankList=[];
85
+        if ($rankList==null) {
86
+            $rankList=[];
87
+        }
82 88
         $rankList=array_slice($rankList, 0, $num);
83 89
         $userInfoRaw=DB::table("users")->select("id as uid", "avatar", "name")->get()->all();
84 90
         $userInfo=[];
@@ -168,7 +174,9 @@  discard block
 block discarded – undo
168 174
     public function getRankTitle($rankVal)
169 175
     {
170 176
         foreach ($this->casualRankingPer as $title=>$c) {
171
-            if ($rankVal<=$c) return $title;
177
+            if ($rankVal<=$c) {
178
+                return $title;
179
+            }
172 180
         }
173 181
         return Arr::last($this->casualRankingPer);
174 182
     }
@@ -176,7 +184,9 @@  discard block
 block discarded – undo
176 184
     public static function getProfessionalTitle($rankVal)
177 185
     {
178 186
         foreach (self::$professionalRankingPer as $title=>$point) {
179
-            if ($rankVal>=$point) return $title;
187
+            if ($rankVal>=$point) {
188
+                return $title;
189
+            }
180 190
         }
181 191
         return Arr::last(self::$professionalRankingPer);
182 192
     }
Please login to merge, or discard this patch.
app/Models/ContestModel.php 1 patch
Braces   +8 added lines, -11 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
                     $paginator=$paginator->where(["practice"=>$filter['practice']]);
229 229
                 }
230 230
                 $paginator=$paginator ->paginate(10);
231
-            }elseif ($filter['public']=='0') {
231
+            } elseif ($filter['public']=='0') {
232 232
                 $paginator=DB::table('group_member')
233 233
                 ->groupBy('contest.cid')
234 234
                 ->select('contest.*')
@@ -1563,8 +1563,7 @@  discard block
 block discarded – undo
1563 1563
                     if (time()>$chache['end_time']) {
1564 1564
                         $this->storeContestRankInMySQL($cid, $ret);
1565 1565
                     }
1566
-                }
1567
-                else {
1566
+                } else {
1568 1567
                     $ret=[];
1569 1568
                     $chache=[];
1570 1569
                     $chache['contest_info']=DB::table("contest")->where("cid", $cid)->first();
@@ -1663,8 +1662,9 @@  discard block
 block discarded – undo
1663 1662
     {
1664 1663
         $id=count($ret);
1665 1664
         foreach ($ret as $key => $r) {
1666
-            if ($r['uid']==$uid)
1667
-                $id=$key;
1665
+            if ($r['uid']==$uid) {
1666
+                            $id=$key;
1667
+            }
1668 1668
         }
1669 1669
         if ($contest_info["rule"]==1) {
1670 1670
             // ACM/ICPC Mode
@@ -1828,8 +1828,7 @@  discard block
 block discarded – undo
1828 1828
             return DB::table("contest_clarification")->where('ccid', '=', $ccid)->update([
1829 1829
                 "public"=>1
1830 1830
             ]);
1831
-        }
1832
-        else
1831
+        } else
1833 1832
         {
1834 1833
             return DB::table("contest_clarification")->where('ccid', '=', $ccid)->update([
1835 1834
                 "public"=>0
@@ -2004,12 +2003,10 @@  discard block
 block discarded – undo
2004 2003
             $zipFile
2005 2004
                 ->saveAsFile(base_path('storage/app/private/'.$path.$cid.".zip")); // save the archive to a file
2006 2005
                 //->extractTo(base_path('storage/app/private/'.$path)); // extract files to the specified directory
2007
-        }
2008
-        catch (\PhpZip\Exception\ZipException $e) {
2006
+        } catch (\PhpZip\Exception\ZipException $e) {
2009 2007
             // handle exception
2010 2008
             Log::debug($e);
2011
-        }
2012
-        finally {
2009
+        } finally {
2013 2010
             $zipFile->close();
2014 2011
         }
2015 2012
     }
Please login to merge, or discard this patch.