Test Setup Failed
Push — master ( d208c1...24e507 )
by
unknown
04:33
created
app/Http/Controllers/VirtualJudge/Judge.php 1 patch
Braces   +23 added lines, -11 removed lines patch added patch discarded remove patch
@@ -118,7 +118,9 @@  discard block
 block discarded – undo
118 118
                     $res = Requests::get('http://contest-hunter.org:83/record/'.$row['remote_id']);
119 119
                     preg_match('/<dt>状态<\/dt>[\s\S]*?<dd class=".*?">(.*?)<\/dd>/m', $res->body, $match);
120 120
                     $status = $match[1];
121
-                    if (!array_key_exists($status, $contesthunter_v)) continue;
121
+                    if (!array_key_exists($status, $contesthunter_v)) {
122
+                        continue;
123
+                    }
122 124
                     $sub['verdict'] = $contesthunter_v[$status];
123 125
                     $sub["score"]=$sub['verdict']=="Accepted"?1:0;
124 126
                     $sub['remote_id'] = $row['remote_id'];
@@ -128,7 +130,9 @@  discard block
 block discarded – undo
128 130
                         $maxtime = 0;
129 131
                         preg_match_all('/<span class="pull-right muted">(\d+) ms \/ \d+ KiB<\/span>/', $res->body, $matches);
130 132
                         foreach ($matches[1] as $time) {
131
-                            if ($time < $maxtime) $maxtime = $time;
133
+                            if ($time < $maxtime) {
134
+                                $maxtime = $time;
135
+                            }
132 136
                         }
133 137
                         $sub['time'] = $maxtime;
134 138
                     } else {
@@ -140,12 +144,13 @@  discard block
 block discarded – undo
140 144
                         "verdict"=>$sub['verdict']
141 145
                     ];
142 146
                     $this->MODEL->update_submission($row['sid'], $sub);
143
-                }
144
-                catch(Exception $e) {}
147
+                } catch(Exception $e) {}
145 148
             } else if ($row['oid'] == 4) {
146 149
                 if (!isset($poj[$row['remote_id']])) {
147 150
                     $this->appendPOJStatus($poj, $pojJudgerName, $row['remote_id']);
148
-                    if (!isset($poj[$row['remote_id']])) continue;
151
+                    if (!isset($poj[$row['remote_id']])) {
152
+                        continue;
153
+                    }
149 154
                 }
150 155
                 $status = $poj[$row['remote_id']];
151 156
                 $sub['verdict'] = $poj_v[$status['verdict']];
@@ -163,7 +168,9 @@  discard block
 block discarded – undo
163 168
                     $res = Requests::get('https://vijos.org/records/'.$row['remote_id']);
164 169
                     preg_match('/<span class="record-status--text \w*">\s*(.*?)\s*<\/span>/', $res->body, $match);
165 170
                     $status = $match[1];
166
-                    if (!array_key_exists($status, $vijos_v)) continue;
171
+                    if (!array_key_exists($status, $vijos_v)) {
172
+                        continue;
173
+                    }
167 174
                     $sub['verdict'] = $vijos_v[$status];
168 175
                     preg_match('/<dt>分数<\/dt>\s*<dd>(\d+)<\/dd>/', $res->body, $match);
169 176
                     $sub['score'] = $match[1];
@@ -172,12 +179,16 @@  discard block
 block discarded – undo
172 179
                         $maxtime = 0;
173 180
                         preg_match_all('/<td class="col--time">(?:&ge;)?(\d+)ms<\/td>/', $res->body, $matches);
174 181
                         foreach ($matches as $match) {
175
-                            if ($match[1] > $maxtime) $maxtime = $match[1];
182
+                            if ($match[1] > $maxtime) {
183
+                                $maxtime = $match[1];
184
+                            }
176 185
                         }
177 186
                         $sub['time'] = $maxtime;
178 187
                         preg_match('/<dt>峰值内存<\/dt>\s*<dd>(?:&ge;)?([\d.]+) ([KM])iB<\/dd>/', $res->body, $match);
179 188
                         $memory = $match[1];
180
-                        if ($match[2] == 'M') $memory *= 1024;
189
+                        if ($match[2] == 'M') {
190
+                            $memory *= 1024;
191
+                        }
181 192
                         $sub['memory'] = intval($memory);
182 193
                     } else {
183 194
                         $sub['memory'] = 0;
@@ -188,8 +199,7 @@  discard block
 block discarded – undo
188 199
                         "verdict"=>$sub['verdict']
189 200
                     ];
190 201
                     $this->MODEL->update_submission($row['sid'], $sub);
191
-                }
192
-                catch(Exception $e) {}
202
+                } catch(Exception $e) {}
193 203
             }
194 204
             // if ($row['oid']=='Spoj') {
195 205
             //     if (isset($spoj_v[$sj[$j][2]])) {
@@ -424,7 +434,9 @@  discard block
 block discarded – undo
424 434
 
425 435
     private function appendPOJStatus(&$results, $judger, $first = null)
426 436
     {
427
-        if ($first !== null) $first++;
437
+        if ($first !== null) {
438
+            $first++;
439
+        }
428 440
         $res = Requests::get("http://poj.org/status?user_id={$judger}&top={$first}");
429 441
         $rows = preg_match_all('/<tr align=center><td>(\d+)<\/td><td>.*?<\/td><td>.*?<\/td><td>.*?<font color=.*?>(.*?)<\/font>.*?<\/td><td>(\d*)K?<\/td><td>(\d*)(?:MS)?<\/td>/', $res->body, $matches);
430 442
         for ($i = 0; $i < $rows; $i++) {
Please login to merge, or discard this patch.