Passed
Pull Request — master (#216)
by Chenyi
04:17
created
app/Models/JudgerModel.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,9 @@
 block discarded – undo
61 61
     {
62 62
         $curl=curl_init();
63 63
 
64
-        if($curl===false) return [];
64
+        if($curl===false) {
65
+            return [];
66
+        }
65 67
 
66 68
         curl_setopt_array($curl, array(
67 69
             CURLOPT_PORT => $port,
Please login to merge, or discard this patch.
app/Models/Rating/RatingCalculator.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
             $mid = floor(($right + $left)/2);
79 79
             if($this->getSeed($mid) < $rank){
80 80
                 $right = $mid;
81
-            }else{
81
+            } else{
82 82
                 $left = $mid;
83 83
             }
84 84
         }
Please login to merge, or discard this patch.
app/Http/Controllers/Ajax/AccountController.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         if(empty($last_send) || time() - $last_send >= 300){
91 91
             $request->session()->put('last_email_send',time());
92 92
             return ResponseModel::success(200,null,0);
93
-        }else{
93
+        } else{
94 94
             $cooldown =  300 - (time() - $last_send);
95 95
             return ResponseModel::success(200,null,$cooldown);
96 96
         }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         foreach ($input as $key => $value) {
110 110
             if(strlen($value) != 0){
111 111
                 $account_model->setExtra($user_id,$key,$value,0);
112
-            }else{
112
+            } else{
113 113
                 $account_model->setExtra($user_id,$key,null);
114 114
             }
115 115
         }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         foreach ($input as $key => $value) {
130 130
             if(strlen($value) != 0){
131 131
                 $account_model->setExtra($user_id,$key,$value,0);
132
-            }else{
132
+            } else{
133 133
                 $account_model->setExtra($user_id,$key,null);
134 134
             }
135 135
         }
Please login to merge, or discard this patch.
app/Babel/Submit/Submitter.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@
 block discarded – undo
35 35
         ];
36 36
 
37 37
         $submitter=self::create($this->post_data["oj"], $sub, $all_data);
38
-        if(!is_null($submitter)) $submitter->submit();
38
+        if(!is_null($submitter)) {
39
+            $submitter->submit();
40
+        }
39 41
 
40 42
         // insert submission
41 43
 
Please login to merge, or discard this patch.
app/Models/AccountModel.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                     }
156 156
                 }
157 157
                 return null;
158
-            }else{
158
+            } else{
159 159
                 foreach ($ret as $value) {
160 160
                     if(empty($value['secret_level']) || $value['secret_level'] <= $secret_level){
161 161
                         $key_name = $this->user_extra[$value['key']] ?? 'unknown';
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             unset($ret['id']);
188 188
             if(!is_null($value)){
189 189
                 $ret['value'] = $value;
190
-            }else{
190
+            } else{
191 191
                 DB::table('users_extra')->where('uid',$uid)->where('key',$key)->delete();
192 192
                 return true;
193 193
             }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                 $ret['secret_level'] = $secret_level;
196 196
             }
197 197
             return DB::table('users_extra')->where('uid',$uid)->where('key',$key)->update($ret);
198
-        }else{
198
+        } else{
199 199
             if($value === null){
200 200
                 return true;
201 201
             }
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         $key = array_search($key,$this->user_extra);
221 221
         if($key){
222 222
             return DB::table('users_extra')->where('key',$key)->where('value',$value)->first();
223
-        }else{
223
+        } else{
224 224
             return null;
225 225
         }
226 226
     }
Please login to merge, or discard this patch.
app/Http/Controllers/ProblemController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,9 @@
 block discarded – undo
132 132
         }
133 133
 
134 134
         $editor_left_width = $account->getExtra(Auth::user()->id, 'editor_left_width');
135
-        if(empty($editor_left_width)) $editor_left_width='40';
135
+        if(empty($editor_left_width)) {
136
+            $editor_left_width='40';
137
+        }
136 138
 
137 139
         return is_null($prob_detail) ?  redirect("/problem") : view('problem.editor', [
138 140
                                             'page_title'=>$prob_detail["title"],
Please login to merge, or discard this patch.
app/Models/Rating/GroupRatingCalculator.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
             $mid = floor(($right + $left)/2);
79 79
             if($this->getSeed($mid) < $rank){
80 80
                 $right = $mid;
81
-            }else{
81
+            } else{
82 82
                 $left = $mid;
83 83
             }
84 84
         }
Please login to merge, or discard this patch.
app/Babel/Install/InstallerBase.php 1 patch
Braces   +27 added lines, -15 removed lines patch added patch discarded remove patch
@@ -23,8 +23,12 @@  discard block
 block discarded – undo
23 23
         $babelConfig=json_decode(file_get_contents(babel_path("Extension/$ocode/babel.json")),true);
24 24
 
25 25
         // support __cur__ variables
26
-        if($babelConfig["version"]=="__cur__") $babelConfig["version"]=explode("-",version())[0];
27
-        if($babelConfig["require"]["NOJ"]=="__cur__") $babelConfig["require"]["NOJ"]=explode("-",version())[0];
26
+        if($babelConfig["version"]=="__cur__") {
27
+            $babelConfig["version"]=explode("-",version())[0];
28
+        }
29
+        if($babelConfig["require"]["NOJ"]=="__cur__") {
30
+            $babelConfig["require"]["NOJ"]=explode("-",version())[0];
31
+        }
28 32
 
29 33
         // check version info
30 34
         if(!isset($babelConfig["version"]) || is_null($babelConfig["version"]) || trim($babelConfig["version"])==""){
@@ -120,11 +124,11 @@  discard block
 block discarded – undo
120 124
         try {
121 125
             if (isset($babelConfig["custom"]["css"]) && !is_null($babelConfig["custom"]["css"]) && trim($babelConfig["custom"]["css"])!="") {
122 126
                 $cssPath=babel_path("Extension/$ocode/".$babelConfig["custom"]["css"]);
123
-            }else{
127
+            } else{
124 128
                 $cssPath=null;
125 129
             }
126 130
             $this->applyCustom($ocode, $cssPath);
127
-        }catch(Exception $e){
131
+        } catch(Exception $e){
128 132
             DB::rollback();
129 133
             $this->command->line("\n  <bg=red;fg=white> Unable to add an custom css for this extension, aborting. </>\n");
130 134
             return;
@@ -136,7 +140,7 @@  discard block
 block discarded – undo
136 140
             $imgPath=babel_path("Extension/$ocode/".$babelConfig["icon"]);
137 141
             $storePath=$this->applyIcon($ocode, $imgPath);
138 142
             OJModel::updateOJ($this->oid,["logo"=>$storePath]);
139
-        }catch(Exception $e){
143
+        } catch(Exception $e){
140 144
             DB::rollback();
141 145
             $this->command->line("\n  <bg=red;fg=white> Unable to add an icon for this extension, aborting. </>\n");
142 146
             return;
@@ -178,22 +182,30 @@  discard block
 block discarded – undo
178 182
                     "available"=>1,
179 183
                     "deleted"=>0
180 184
                 ]);
181
-            }elseif($m["method"]=="modify"){
185
+            } elseif($m["method"]=="modify"){
182 186
                 $modifyItem=[];
183
-                if(isset($m["compability"])) $modifyItem["comp"]=$m["compability"];
184
-                if(isset($m["language"])) $modifyItem["lang"]=$m["language"];
185
-                if(isset($m["icon"])) $modifyItem["icon"]=$m["icon"];
186
-                if(isset($m["display"])) $modifyItem["display_name"]=$m["display"];
187
+                if(isset($m["compability"])) {
188
+                    $modifyItem["comp"]=$m["compability"];
189
+                }
190
+                if(isset($m["language"])) {
191
+                    $modifyItem["lang"]=$m["language"];
192
+                }
193
+                if(isset($m["icon"])) {
194
+                    $modifyItem["icon"]=$m["icon"];
195
+                }
196
+                if(isset($m["display"])) {
197
+                    $modifyItem["display_name"]=$m["display"];
198
+                }
187 199
                 CompilerModel::modify([
188 200
                     "oid"=>$this->oid,
189 201
                     "lcode"=>$m["code"],
190 202
                 ], $modifyItem);
191
-            }elseif($m["method"]=="remove"){
203
+            } elseif($m["method"]=="remove"){
192 204
                 CompilerModel::remove([
193 205
                     "oid"=>$this->oid,
194 206
                     "lcode"=>$m["code"],
195 207
                 ]);
196
-            }else{
208
+            } else{
197 209
                 continue;
198 210
             }
199 211
         }
@@ -205,7 +217,7 @@  discard block
 block discarded – undo
205 217
         $storePath=base_path("public/static/img/oj/$ocode/");
206 218
         if(is_dir($storePath)) {
207 219
             $this->delFile($storePath);
208
-        }else{
220
+        } else{
209 221
             mkdir($storePath);
210 222
         }
211 223
         file_put_contents($storePath.basename($imgPath),file_get_contents($imgPath));
@@ -220,7 +232,7 @@  discard block
 block discarded – undo
220 232
         }
221 233
         if (is_null($cssPath)) {
222 234
             file_put_contents($storePath."$ocode.css", "\/*Silence is Golden*\/");
223
-        }else {
235
+        } else {
224 236
             file_put_contents($storePath."$ocode.css", file_get_contents($cssPath));
225 237
         }
226 238
     }
@@ -231,7 +243,7 @@  discard block
 block discarded – undo
231 243
                 if($item!= "." && $item != ".."){
232 244
                     if(file_exists($dirName.'/'.$item) && is_dir($dirName.'/'.$item)){
233 245
                         delFile($dirName.'/'.$item);
234
-                    }else{
246
+                    } else{
235 247
                         if(unlink($dirName.'/'.$item)){
236 248
                             return true;
237 249
                         }
Please login to merge, or discard this patch.
app/Babel/Crawl/CrawlerBase.php 1 patch
Braces   +21 added lines, -5 removed lines patch added patch discarded remove patch
@@ -136,10 +136,26 @@  discard block
 block discarded – undo
136 136
 
137 137
     public function procInfo($data)
138 138
     {
139
-        if(isset($data["path"]))       $path = $data["path"];             else throw new Exception("path is not exist in data");
140
-        if(isset($data["baseurl"]))    $baseurl = $data["baseurl"];       else throw new Exception("baseurl is not exist in data");
141
-        if(isset($data["space_deli"])) $space_deli = $data["space_deli"]; else $space_deli = true;
142
-        if(isset($data["cookie"]))     $cookie = $data["cookie"];         else $cookie = "";
139
+        if(isset($data["path"])) {
140
+            $path = $data["path"];
141
+        } else {
142
+            throw new Exception("path is not exist in data");
143
+        }
144
+        if(isset($data["baseurl"])) {
145
+            $baseurl = $data["baseurl"];
146
+        } else {
147
+            throw new Exception("baseurl is not exist in data");
148
+        }
149
+        if(isset($data["space_deli"])) {
150
+            $space_deli = $data["space_deli"];
151
+        } else {
152
+            $space_deli = true;
153
+        }
154
+        if(isset($data["cookie"])) {
155
+            $cookie = $data["cookie"];
156
+        } else {
157
+            $cookie = "";
158
+        }
143 159
 
144 160
         $this->pro["description"]=$this->_cacheImage($this->pro["description"], $path, $baseurl, $space_deli, $cookie);
145 161
         $this->pro["input"]=$this->_cacheImage($this->pro["input"], $path, $baseurl, $space_deli, $cookie);
@@ -176,7 +192,7 @@  discard block
 block discarded – undo
176 192
     {
177 193
         if(is_null($this->command)){
178 194
             echo $line;
179
-        }else{
195
+        } else{
180 196
             $this->command->line($line);
181 197
         }
182 198
     }
Please login to merge, or discard this patch.