Passed
Push — master ( affb10...b25042 )
by John
18:32 queued 13:30
created
app/Models/Latex/LatexModel.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,9 @@
 block discarded – undo
9 9
 {
10 10
     public static function info($ltxsource, $type="png")
11 11
     {
12
-        if(!in_array($type,['png','svg'])) return [];
12
+        if(!in_array($type,['png','svg'])) {
13
+            return [];
14
+        }
13 15
         $url=route("latex.$type", ['ltxsource' => $ltxsource]);
14 16
         $image = new Imagick();
15 17
         $image->readImageBlob(Storage::get('latex-svg/'.urlencode($ltxsource).'.svg'));
Please login to merge, or discard this patch.
app/Models/ContestModel.php 1 patch
Braces   +28 added lines, -31 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.*')
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
                 )
259 259
                 ->orderBy('contest.begin_time', 'desc')
260 260
                 ->paginate(10);
261
-            }else{
261
+            } else{
262 262
                 $paginator=DB::table('group_member')
263 263
                 ->groupBy('contest.cid')
264 264
                 ->select('contest.*')
@@ -810,13 +810,13 @@  discard block
 block discarded – undo
810 810
         if(time() < $end_time){
811 811
             if($clearance == 3){
812 812
                 $contestRankRaw=Cache::tags(['contest', 'rank'])->get("contestAdmin$cid");
813
-            }else{
813
+            } else{
814 814
                 $contestRankRaw=Cache::tags(['contest', 'rank'])->get($cid);
815 815
             }
816 816
             if(!isset($contestRankRaw)){
817 817
                 $contestRankRaw=$contest_eloquent->rankRefresh();
818 818
             }
819
-        }else{
819
+        } else{
820 820
             if($clearance == 3){
821 821
                 $contestRankRaw=Cache::tags(['contest', 'rank'])->get("contestAdmin$cid");
822 822
                 if (!isset($contestRankRaw)) {
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
                         $this->storeContestRankInMySQL($cid, $contestRankRaw);
827 827
                     }
828 828
                 }
829
-            }else{
829
+            } else{
830 830
                 $contestRankRaw=$this->getContestRankFromMySQL($cid);
831 831
                 if(!isset($contestRankRaw)){
832 832
                     $contestRankRaw=Cache::tags(['contest', 'rank'])->get($cid);
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
             return DB::table("contest_clarification")->where([
912 912
                 "cid"=>$cid
913 913
             ])->orderBy('created_at', 'desc')->get()->all();
914
-        }else{
914
+        } else{
915 915
             return DB::table("contest_clarification")->where([
916 916
                 "cid"=>$cid
917 917
             ])->where(function ($query) {
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
         $filter['pid'] = array_search($filter['ncode'], array_column($problemSet_temp, 'ncode'));
1077 1077
         if($filter['pid']==false){
1078 1078
             $filter['pid'] = null;
1079
-        }else{
1079
+        } else{
1080 1080
             $filter['pid'] = $problemSet_temp[$filter['pid']]['pid'];
1081 1081
         }
1082 1082
 
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
                     "records"=>[]
1185 1185
                 ];
1186 1186
             }
1187
-        }else{
1187
+        } else{
1188 1188
             if ($basicInfo["status_visibility"]==2) {
1189 1189
                 // View all
1190 1190
                 $paginator=DB::table("submission")->where([
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
             if($ratingCalculator->calculate()){
1435 1435
                 $ratingCalculator->storage();
1436 1436
                 return true;
1437
-            }else{
1437
+            } else{
1438 1438
                 return false;
1439 1439
             }
1440 1440
         } else {
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
             $contestRankRaw = $this->contestRankCache($cid);
1484 1484
             Cache::tags(['contest', 'rank'])->put($cid, $contestRankRaw);
1485 1485
             Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $contestRankRaw);
1486
-        }else{
1486
+        } else{
1487 1487
             DB::table($this->tableName)
1488 1488
                 ->where('cid',$cid)
1489 1489
                 ->update($data);
@@ -1585,8 +1585,7 @@  discard block
 block discarded – undo
1585 1585
                     if(time() > $chache['end_time']){
1586 1586
                         $this->storeContestRankInMySQL($cid, $ret);
1587 1587
                     }
1588
-                }
1589
-                else{
1588
+                } else{
1590 1589
                     $ret=[];
1591 1590
                     $chache=[];
1592 1591
                     $chache['contest_info']=DB::table("contest")->where("cid", $cid)->first();
@@ -1601,7 +1600,7 @@  discard block
 block discarded – undo
1601 1600
                             "cid"=>$cid,
1602 1601
                             "audit"=>1
1603 1602
                         ])->select('uid')->get()->all();
1604
-                    }else{
1603
+                    } else{
1605 1604
                         $submissionUsers=DB::table("submission")->where([
1606 1605
                             "cid"=>$cid
1607 1606
                         ])->where(
@@ -1636,9 +1635,9 @@  discard block
 block discarded – undo
1636 1635
                     Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $retAdmin);
1637 1636
                 }
1638 1637
             }
1639
-        }catch(LockTimeoutException $e){
1638
+        } catch(LockTimeoutException $e){
1640 1639
             Log::warning("Contest Rank Lock Timed Out");
1641
-        }finally{
1640
+        } finally{
1642 1641
             optional($lock)->release();
1643 1642
         }
1644 1643
     }
@@ -1661,7 +1660,7 @@  discard block
 block discarded – undo
1661 1660
                     return 1;
1662 1661
                 }
1663 1662
             });
1664
-        }else if ($contest_info["rule"]==2){
1663
+        } else if ($contest_info["rule"]==2){
1665 1664
             usort($ret, function ($a, $b) {
1666 1665
                 if ($a["score"]==$b["score"]) {
1667 1666
                     if ($a["solved"]==$b["solved"]) {
@@ -1685,8 +1684,9 @@  discard block
 block discarded – undo
1685 1684
     {
1686 1685
         $id = count($ret);
1687 1686
         foreach($ret as $key => $r){
1688
-            if($r['uid'] == $uid)
1689
-                $id = $key;
1687
+            if($r['uid'] == $uid) {
1688
+                            $id = $key;
1689
+            }
1690 1690
         }
1691 1691
         if ($contest_info["rule"]==1) {
1692 1692
             // ACM/ICPC Mode
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
                 $prob_detail = [];
1695 1695
                 $totPen = 0;
1696 1696
                 $totScore = 0;
1697
-            }else{
1697
+            } else{
1698 1698
                 $prob_detail = $ret[$id]['problem_detail'];
1699 1699
                 $totPen=$ret[$id]['penalty'];
1700 1700
                 $totScore=$ret[$id]['score'];
@@ -1749,7 +1749,7 @@  discard block
 block discarded – undo
1749 1749
                 $prob_detail = [];
1750 1750
                 $totSolved = 0;
1751 1751
                 $totScore = 0;
1752
-            }else{
1752
+            } else{
1753 1753
                 $prob_detail = $ret[$id]['problem_detail'];
1754 1754
                 $totSolved=$ret[$id]['solved'];
1755 1755
                 $totScore=$ret[$id]['score'];
@@ -1812,18 +1812,18 @@  discard block
 block discarded – undo
1812 1812
                 return false;
1813 1813
             }
1814 1814
             return true;
1815
-        }else if($status === 0){
1815
+        } else if($status === 0){
1816 1816
             if($begin_time_new !== null){
1817 1817
                 return false;
1818 1818
             }
1819 1819
             if($end_time_new !== null){
1820 1820
                 if(strtotime($end_time_new) <= time()){
1821 1821
                     return false;
1822
-                }else{
1822
+                } else{
1823 1823
                     return true;
1824 1824
                 }
1825 1825
             }
1826
-        }else{
1826
+        } else{
1827 1827
             return false;
1828 1828
         }
1829 1829
 
@@ -1844,8 +1844,7 @@  discard block
 block discarded – undo
1844 1844
             return DB::table("contest_clarification")->where('ccid','=',$ccid)->update([
1845 1845
                 "public"=>1
1846 1846
             ]);
1847
-        }
1848
-        else
1847
+        } else
1849 1848
         {
1850 1849
             return DB::table("contest_clarification")->where('ccid','=',$ccid)->update([
1851 1850
                 "public"=>0
@@ -1869,7 +1868,7 @@  discard block
 block discarded – undo
1869 1868
             ->whereIn('pid',array_column($contestRank[0]['problem_detail'],'pid'))
1870 1869
             ->select('pid','title')
1871 1870
             ->get()->all();
1872
-        }else{
1871
+        } else{
1873 1872
             $all_problems = [];
1874 1873
         }
1875 1874
         $tags = DB::table('group_problem_tag')
@@ -2022,12 +2021,10 @@  discard block
 block discarded – undo
2022 2021
             $zipFile
2023 2022
                 ->saveAsFile(base_path('storage/app/private/'.$path.$cid.".zip")); // save the archive to a file
2024 2023
                 //->extractTo(base_path('storage/app/private/'.$path)); // extract files to the specified directory
2025
-        }
2026
-        catch(\PhpZip\Exception\ZipException $e){
2024
+        } catch(\PhpZip\Exception\ZipException $e){
2027 2025
             // handle exception
2028 2026
             Log::debug($e);
2029
-        }
2030
-        finally{
2027
+        } finally{
2031 2028
             $zipFile->close();
2032 2029
         }
2033 2030
     }
@@ -2053,7 +2050,7 @@  discard block
 block discarded – undo
2053 2050
             return [
2054 2051
                 'result' => true
2055 2052
             ];
2056
-        }else{
2053
+        } else{
2057 2054
             return [
2058 2055
                 'result' => false,
2059 2056
                 'sid' => $submissions
Please login to merge, or discard this patch.
app/Console/Commands/Manage/BanUser.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
                 'removed_at' => $ban_time
56 56
             ]);
57 57
             $this->line("The user <fg=yellow>{$user->name}</> will be banned until <fg=yellow>{$ban_time}</>");
58
-        }catch(Throwable $e){
58
+        } catch(Throwable $e){
59 59
             $this->line("\n  <bg=red;fg=white> Exception </> : <fg=yellow>Wrong Time.</>\n");
60 60
             return;
61 61
         }
Please login to merge, or discard this patch.
app/Jobs/AntiCheat.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
         $cid=$this->cid;
55 55
         $contest=EloquentContestModel::find($cid);
56 56
 
57
-        if(!$contest->isJudgingComplete()) throw new Exception('Judging Incompleted');
57
+        if(!$contest->isJudgingComplete()) {
58
+            throw new Exception('Judging Incompleted');
59
+        }
58 60
 
59 61
         $acceptedSubmissions=$contest->submissions->whereIn('verdict', [
60 62
             'Accepted',
@@ -128,9 +130,13 @@  discard block
 block discarded – undo
128 130
         $reportPath="contest/anticheat/$cid/report/$prob/$lang";
129 131
         $generalPage=HtmlDomParser::str_get_html(Storage::disk('local')->get("$reportPath/index.html"), true, true, DEFAULT_TARGET_CHARSET, false);
130 132
         $table=$generalPage->find('table', 0);
131
-        if(is_null($table)) return;
133
+        if(is_null($table)) {
134
+            return;
135
+        }
132 136
         foreach($table->find('tr') as $tr){
133
-            if(Str::contains($tr->outertext, '<th>')) continue;
137
+            if(Str::contains($tr->outertext, '<th>')) {
138
+                continue;
139
+            }
134 140
             $firstUID=null;
135 141
             foreach($tr->find('a') as $a){
136 142
                 $a->innertext=explode("$rawPath/",$a->plaintext)[1];
@@ -157,9 +163,13 @@  discard block
 block discarded – undo
157 163
             foreach($langs as $lang=>$availableVal){
158 164
                 $probPage=HtmlDomParser::str_get_html(Storage::disk('local')->get("contest/anticheat/$cid/report/$prob/$lang/index.html"), true, true, DEFAULT_TARGET_CHARSET, false);
159 165
                 $table=$probPage->find('table', 0);
160
-                if(is_null($table)) continue;
166
+                if(is_null($table)) {
167
+                    continue;
168
+                }
161 169
                 foreach($table->find('tr') as $tr){
162
-                    if(Str::contains($tr->outertext, '<th>')) continue;
170
+                    if(Str::contains($tr->outertext, '<th>')) {
171
+                        continue;
172
+                    }
163 173
                     $submissionA=$tr->children(0)->children(0);
164 174
                     $submissionB=$tr->children(1)->children(0);
165 175
                     $linesMatch=$tr->children(2);
Please login to merge, or discard this patch.
app/Http/Middleware/Contest/IsDesktop.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
             }
29 29
             if(strtolower($request->method()) == 'get'){
30 30
                 return response()->redirectToRoute('contest.detail',['cid' => $contest->cid]);
31
-            }else{
31
+            } else{
32 32
                 return header("HTTP/1.1 403 Forbidden");
33 33
             }
34 34
         }
Please login to merge, or discard this patch.
app/Http/Middleware/Api/Contest/Clearance.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
                     'contest' => $contest
33 33
                 ]);
34 34
                 return $next($request);
35
-            }else{
35
+            } else{
36 36
                 return response()->json([
37 37
                     'success' => false,
38 38
                     'message' => 'Contest Not Found',
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
                     ]
45 45
                 ]);
46 46
             }
47
-        }else if($contest->judgeClearance($request->cid,$user->id) >= $clearance) {
47
+        } else if($contest->judgeClearance($request->cid,$user->id) >= $clearance) {
48 48
             $contest = Contest::find($request->cid);
49 49
             $request->merge([
50 50
                 'contest' => $contest
51 51
             ]);
52 52
             return $next($request);
53
-        }else{
53
+        } else{
54 54
             return response()->json([
55 55
                 'success' => false,
56 56
                 'message' => 'Permission Denied',
Please login to merge, or discard this patch.
app/Http/Controllers/Api/ContestController.php 1 patch
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         if($contest->status_visibility == 1){
73 73
             if(auth()->check()){
74 74
                 $builder = $builder->where('uid', auth()->user()->id);
75
-            }else{
75
+            } else{
76 76
                 $builder = $builder->where('uid', -1);
77 77
             }
78 78
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             if($contest->rule == 2){
109 109
                 if($submission->verdict == 'Accepted') {
110 110
                     $score_parse = 100;
111
-                }else if($submission->verdict == 'Partially Accepted') {
111
+                } else if($submission->verdict == 'Partially Accepted') {
112 112
                     $score_parse = round($submission->score / $submission->problem->tot_score * $contest->problems()->where('pid', $submission->problem->pid)->first()->points, 1);
113 113
                 }
114 114
             }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                 'enable' => true,
150 150
                 'frozen_length' => $contest->forze_length
151 151
             ];
152
-        }else{
152
+        } else{
153 153
             $frozen = [
154 154
                 'enable' => false,
155 155
                 'frozen_length' => 0
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
                 $header['problemsSubHeader'][] = $problem->submissions()->where('submission_date', '<=', $contest->frozen_time)->where('verdict', 'Accepted')->count()
174 174
                                                 . ' / ' . $problem->submissions()->where('submission_date', '<=', $contest->frozen_time)->count();
175 175
             }
176
-        }else if($contest->rule == 2){
176
+        } else if($contest->rule == 2){
177 177
             $header = [
178 178
                 'rank' => 'Rank',
179 179
                 'normal' => [
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                 ];
222 222
                 $body[] = $userBody;
223 223
             }
224
-        }else if($contest->rule == 2){
224
+        } else if($contest->rule == 2){
225 225
             $body = [];
226 226
             $lastRank = null;
227 227
             $rank = 1;
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
         ];
436 436
         try{
437 437
             dispatch(new ProcessSubmission($all_data))->onQueue($problem->oj);
438
-        }catch(\Throwable $e){
438
+        } catch(\Throwable $e){
439 439
             return response()->json([
440 440
                 'success' => false,
441 441
                 'message' => $e->getMessage(),
Please login to merge, or discard this patch.
app/Models/Eloquent/Contest.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
                 $users->add($user);
29 29
             }
30 30
             return $users->unique();
31
-        }else{
31
+        } else{
32 32
             $this->load('submissions.user');
33 33
             if($ignore_frozen){
34 34
                 $frozen_time = $this->frozen_time;
35 35
                 $submissions = $this->submissions()->where('submission_date','<',$frozen_time)->get();
36
-            }else{
36
+            } else{
37 37
                 $submissions = $this->submissions;
38 38
             }
39 39
             $users = new EloquentCollection;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             });
103 103
             Cache::tags(['contest', 'rank'])->put($this->cid, $ret, 60);
104 104
             return $ret;
105
-        }else{
105
+        } else{
106 106
             // IO Mode
107 107
             $c = new OutdatedContestModel();
108 108
             return $c->contestRankCache($this->cid);
Please login to merge, or discard this patch.
app/Admin/Controllers/ProblemController.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                     $zip->addFromString('info', json_encode($info_content));
273 273
                     $zip->close();
274 274
                     //$err('The zip files must include a file named info including info of test cases, and the format can see ZsgsDesign/NOJ wiki.');
275
-                }else{
275
+                } else{
276 276
                     $info_content = json_decode($zip->getFromName('info'),true);
277 277
                 };
278 278
                 $zip->open($path);
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
                     $problem = EloquentProblemModel::find($form->pid);
290 290
                     if(!empty($problem)){
291 291
                         $pcode = $problem->pcode;
292
-                    }else{
292
+                    } else{
293 293
                         $pcode = $form->pcode;
294 294
                     }
295
-                }else{
295
+                } else{
296 296
                     $pcode = $form->pcode;
297 297
                 }
298 298
 
Please login to merge, or discard this patch.