Passed
Branch feature/babel (6fdbb7)
by John
08:36
created
app/Babel/Crawler/CrawlerBase.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 
52 52
     public function cacheImage($data)
53 53
     {
54
-        if(!isset($data["ori"]) || !isset($data["path"]) || !isset($data["baseurl"]) || !isset($data["space_deli"]) || !isset($data["cookie"])){
54
+        if (!isset($data["ori"]) || !isset($data["path"]) || !isset($data["baseurl"]) || !isset($data["space_deli"]) || !isset($data["cookie"])) {
55 55
             throw new Exception("data is not completely exist in cacheImage");
56 56
         }
57
-        $ori = $data["ori"];
58
-        $path = $data["path"];
59
-        $baseurl = $data["baseurl"];
60
-        $space_deli = $data["space_deli"];
61
-        $cookie = $data["cookie"];
57
+        $ori=$data["ori"];
58
+        $path=$data["path"];
59
+        $baseurl=$data["baseurl"];
60
+        $space_deli=$data["space_deli"];
61
+        $cookie=$data["cookie"];
62 62
 
63 63
         $para["path"]=$path;
64 64
         $para["base"]=$baseurl;
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 
104 104
     public function procInfo($data)
105 105
     {
106
-        if(isset($data["path"]))       $path = $data["path"];             else throw new Exception("path is not exist in data");
107
-        if(isset($data["baseurl"]))    $baseurl = $data["baseurl"];       else throw new Exception("baseurl is not exist in data");
108
-        if(isset($data["space_deli"])) $space_deli = $data["space_deli"]; else $space_deli = true;
109
-        if(isset($data["cookie"]))     $cookie = $data["cookie"];         else $cookie = "";
106
+        if (isset($data["path"]))       $path=$data["path"]; else throw new Exception("path is not exist in data");
107
+        if (isset($data["baseurl"]))    $baseurl=$data["baseurl"]; else throw new Exception("baseurl is not exist in data");
108
+        if (isset($data["space_deli"])) $space_deli=$data["space_deli"]; else $space_deli=true;
109
+        if (isset($data["cookie"]))     $cookie=$data["cookie"]; else $cookie="";
110 110
 
111 111
         $this->pro["description"]=$this->cacheImage($this->pro["description"], $path, $baseurl, $space_deli, $cookie);
112 112
         $this->pro["input"]=$this->cacheImage($this->pro["input"], $path, $baseurl, $space_deli, $cookie);
Please login to merge, or discard this patch.
Braces   +20 added lines, -4 removed lines patch added patch discarded remove patch
@@ -103,10 +103,26 @@
 block discarded – undo
103 103
 
104 104
     public function procInfo($data)
105 105
     {
106
-        if(isset($data["path"]))       $path = $data["path"];             else throw new Exception("path is not exist in data");
107
-        if(isset($data["baseurl"]))    $baseurl = $data["baseurl"];       else throw new Exception("baseurl is not exist in data");
108
-        if(isset($data["space_deli"])) $space_deli = $data["space_deli"]; else $space_deli = true;
109
-        if(isset($data["cookie"]))     $cookie = $data["cookie"];         else $cookie = "";
106
+        if(isset($data["path"])) {
107
+            $path = $data["path"];
108
+        } else {
109
+            throw new Exception("path is not exist in data");
110
+        }
111
+        if(isset($data["baseurl"])) {
112
+            $baseurl = $data["baseurl"];
113
+        } else {
114
+            throw new Exception("baseurl is not exist in data");
115
+        }
116
+        if(isset($data["space_deli"])) {
117
+            $space_deli = $data["space_deli"];
118
+        } else {
119
+            $space_deli = true;
120
+        }
121
+        if(isset($data["cookie"])) {
122
+            $cookie = $data["cookie"];
123
+        } else {
124
+            $cookie = "";
125
+        }
110 126
 
111 127
         $this->pro["description"]=$this->cacheImage($this->pro["description"], $path, $baseurl, $space_deli, $cookie);
112 128
         $this->pro["input"]=$this->cacheImage($this->pro["input"], $path, $baseurl, $space_deli, $cookie);
Please login to merge, or discard this patch.
app/Babel/Crawler/Crawler.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@
 block discarded – undo
22 22
 
23 23
     public static function create($conf) {
24 24
         $name=$conf["name"];
25
-        $className = "App\\Babel\\Extension\\$name\\Crawler";
26
-        if(class_exists($className)) {
25
+        $className="App\\Babel\\Extension\\$name\\Crawler";
26
+        if (class_exists($className)) {
27 27
             return new $className($conf);
28 28
         } else {
29 29
             return null;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
     public function __construct($conf)
18 18
     {
19 19
         $crawler=self::create($conf);
20
-        if (!is_null($crawler) && isset($crawler)) $this->data=$crawler->data;
20
+        if (!is_null($crawler) && isset($crawler)) {
21
+            $this->data=$crawler->data;
22
+        }
21 23
     }
22 24
 
23 25
     public static function create($conf) {
Please login to merge, or discard this patch.
app/Babel/Judge/Judger.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $result=$submissionModel->getWaitingSubmission();
32 32
         foreach ($result as $row) {
33 33
             $ocode=$row["ocode"];
34
-            if(!isset($this->$judger[$ocode]) || is_null($this->$judger[$ocode])) {
34
+            if (!isset($this->$judger[$ocode]) || is_null($this->$judger[$ocode])) {
35 35
                 $this->$judger[$ocode]=self::create($ocode);
36 36
             }
37 37
             $this->$judger[$ocode]->judge($row);
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 
41 41
     public static function create($ocode) {
42 42
         $name=$ocode;
43
-        $className = "App\\Babel\\Extension\\$name\\Judger";
44
-        if(class_exists($className)) {
43
+        $className="App\\Babel\\Extension\\$name\\Judger";
44
+        if (class_exists($className)) {
45 45
             return new $className();
46 46
         } else {
47 47
             return null;
Please login to merge, or discard this patch.
app/Models/SubmissionModel.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
                                             ->select("sid", "OJ as oid", "remote_id", "cid", "jid")
412 412
                                             ->where(['verdict'=>'Waiting'])
413 413
                                             ->get();
414
-        foreach($ret as &$r){
414
+        foreach ($ret as &$r) {
415 415
             $r["ocode"]=DB::table("OJ")->where(["oid"=>$r["oid"]])->first()["ocode"];
416 416
         }
417 417
         return $ret;
@@ -429,15 +429,15 @@  discard block
 block discarded – undo
429 429
         if (isset($sub['verdict'])) {
430 430
             $sub["color"]=$this->colorScheme[$sub['verdict']];
431 431
         }
432
-        $result = DB::table($this->tableName)->where(['sid'=>$sid])->update($sub);
433
-
434
-        $contestModel = new ContestModel();
435
-        $submission_info = DB::table($this->tableName) -> where(['sid'=>$sid]) -> get() -> first();
436
-        if ($submission_info['cid'] && $contestModel->isContestRunning($submission_info['cid'])){
437
-            $sub['pid'] = $submission_info['pid'];
438
-            $sub['uid'] = $submission_info['uid'];
439
-            $sub['cid'] = $submission_info['cid'];
440
-            $contestModel->updateContestRankTable($submission_info['cid'],$sub);
432
+        $result=DB::table($this->tableName)->where(['sid'=>$sid])->update($sub);
433
+
434
+        $contestModel=new ContestModel();
435
+        $submission_info=DB::table($this->tableName) -> where(['sid'=>$sid]) -> get() -> first();
436
+        if ($submission_info['cid'] && $contestModel->isContestRunning($submission_info['cid'])) {
437
+            $sub['pid']=$submission_info['pid'];
438
+            $sub['uid']=$submission_info['uid'];
439
+            $sub['cid']=$submission_info['cid'];
440
+            $contestModel->updateContestRankTable($submission_info['cid'], $sub);
441 441
         }
442 442
         return $result;
443 443
     }
@@ -508,15 +508,15 @@  discard block
 block discarded – undo
508 508
             'desc'
509 509
         );
510 510
 
511
-        if($filter["pcode"]){
511
+        if ($filter["pcode"]) {
512 512
             $paginator=$paginator->where(["pcode"=>$filter["pcode"]]);
513 513
         }
514 514
 
515
-        if($filter["result"]){
515
+        if ($filter["result"]) {
516 516
             $paginator=$paginator->where(["verdict"=>$filter["result"]]);
517 517
         }
518 518
 
519
-        if($filter["account"]){
519
+        if ($filter["account"]) {
520 520
             $paginator=$paginator->where(["name"=>$filter["account"]]);
521 521
         }
522 522
 
Please login to merge, or discard this patch.