Passed
Pull Request — master (#610)
by John
05:33
created
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/GroupModel.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -121,7 +121,9 @@  discard block
 block discarded – undo
121 121
     public function details($gcode)
122 122
     {
123 123
         $basic_info=DB::table($this->tableName)->where(["gcode"=>$gcode])->first();
124
-        if (empty($basic_info)) return [];
124
+        if (empty($basic_info)) {
125
+            return [];
126
+        }
125 127
         $basic_info["members"]=$this->countGroupMembers($basic_info["gid"]);
126 128
         $basic_info["tags"]=$this->getGroupTags($basic_info["gid"]);
127 129
         $basic_info["create_time_foramt"]=date_format(date_create($basic_info["created_at"]), 'M jS, Y');
@@ -169,7 +171,9 @@  discard block
 block discarded – undo
169 171
         foreach ($user_list as &$u) {
170 172
             $u["role_parsed"]=$this->role[$u["role"]];
171 173
             $u["role_color"]=$this->role_color[$u["role"]];
172
-            if (is_null($u["sub_group"])) $u["sub_group"]="None";
174
+            if (is_null($u["sub_group"])) {
175
+                $u["sub_group"]="None";
176
+            }
173 177
         }
174 178
         return $user_list;
175 179
     }
@@ -300,7 +304,9 @@  discard block
 block discarded – undo
300 304
     public function judgeEmailClearance($gid, $email)
301 305
     {
302 306
         $user=DB::table("users")->where(["email"=>$email])->first();
303
-        if (empty($user)) return -4;
307
+        if (empty($user)) {
308
+            return -4;
309
+        }
304 310
         $ret=DB::table("group_member")->where([
305 311
             "gid"=>$gid,
306 312
             "uid"=>$user["id"],
Please login to merge, or discard this patch.
app/Models/ProblemModel.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -454,7 +454,9 @@  discard block
 block discarded – undo
454 454
 
455 455
         if (!empty($data["sample"])) {
456 456
             foreach ($data["sample"] as $d) {
457
-                if (!isset($d['sample_note'])) $d['sample_note']=null;
457
+                if (!isset($d['sample_note'])) {
458
+                    $d['sample_note']=null;
459
+                }
458 460
                 DB::table("problem_sample")->insert([
459 461
                     'pid'=>$pid,
460 462
                     'sample_input'=>$d['sample_input'],
@@ -503,7 +505,9 @@  discard block
 block discarded – undo
503 505
 
504 506
         if (!empty($data["sample"])) {
505 507
             foreach ($data["sample"] as $d) {
506
-                if (!isset($d['sample_note'])) $d['sample_note']=null;
508
+                if (!isset($d['sample_note'])) {
509
+                    $d['sample_note']=null;
510
+                }
507 511
                 DB::table("problem_sample")->insert([
508 512
                     'pid'=>$pid,
509 513
                     'sample_input'=>$d['sample_input'],
Please login to merge, or discard this patch.
app/Models/Babel/ExtensionModel.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,7 +80,9 @@  discard block
 block discarded – undo
80 80
     {
81 81
         $ret=[];
82 82
         $marketspaceRaw=self::getRemote();
83
-        if (empty($marketspaceRaw)) return [];
83
+        if (empty($marketspaceRaw)) {
84
+            return [];
85
+        }
84 86
         foreach ($marketspaceRaw["packages"] as $extension) {
85 87
             $temp=[
86 88
                 "details"=>$extension,
@@ -136,7 +138,9 @@  discard block
 block discarded – undo
136 138
         foreach ($dirs as $d) {
137 139
             $extension=basename($d);
138 140
             $BabelConfig=json_decode(file_get_contents(babel_path("Extension/$extension/babel.json")), true);
139
-            if ($extension==$BabelConfig["code"]) $ret[]=$BabelConfig;
141
+            if ($extension==$BabelConfig["code"]) {
142
+                $ret[]=$BabelConfig;
143
+            }
140 144
         }
141 145
         return $ret;
142 146
     }
@@ -153,10 +157,14 @@  discard block
 block discarded – undo
153 157
     public static function remoteDetail($code)
154 158
     {
155 159
         $babelConfig=self::getRemote();
156
-        if (empty($babelConfig)) return [];
160
+        if (empty($babelConfig)) {
161
+            return [];
162
+        }
157 163
         $babelConfigPackages=$babelConfig["packages"];
158 164
         foreach ($babelConfigPackages as $package) {
159
-            if ($package["code"]==$code) return $package;
165
+            if ($package["code"]==$code) {
166
+                return $package;
167
+            }
160 168
         }
161 169
         return [];
162 170
     }
Please login to merge, or discard this patch.
app/Models/JudgerModel.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,9 @@
 block discarded – undo
67 67
     public function fetchServer($oid=0)
68 68
     {
69 69
         $serverList=DB::table("judge_server");
70
-        if ($oid) $serverList=$serverList->where(["oid"=>$oid]);
70
+        if ($oid) {
71
+            $serverList=$serverList->where(["oid"=>$oid]);
72
+        }
71 73
         $serverList=$serverList->get()->all();
72 74
         foreach ($serverList as &$server) {
73 75
             $server["status_parsed"]=is_null($server["status"]) ?self::$status["-1"] : self::$status[$server["status"]];
Please login to merge, or discard this patch.
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/Eloquent/Dojo/Dojo.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,8 +42,12 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $precondition=[];
44 44
         foreach (explode(',', $value) as $dojo_id) {
45
-            if (blank($dojo_id)) continue;
46
-            if (!is_null(Dojo::find($dojo_id))) $precondition[]=$dojo_id;
45
+            if (blank($dojo_id)) {
46
+                continue;
47
+            }
48
+            if (!is_null(Dojo::find($dojo_id))) {
49
+                $precondition[]=$dojo_id;
50
+            }
47 51
         }
48 52
         return $precondition;
49 53
     }
@@ -66,7 +70,9 @@  discard block
 block discarded – undo
66 70
     public function getAvailabilityAttribute()
67 71
     {
68 72
         foreach ($this->precondition as $dojo_id) {
69
-            if (!DojoPass::isPassed($dojo_id)) return 'locked';
73
+            if (!DojoPass::isPassed($dojo_id)) {
74
+                return 'locked';
75
+            }
70 76
         }
71 77
         return $this->passed ? 'passed' : 'available';
72 78
     }
Please login to merge, or discard this patch.