Passed
Pull Request — master (#256)
by Chenyi
04:14
created
app/Babel/Install/InstallerWorker.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,9 +84,9 @@
 block discarded – undo
84 84
             $installed_timestamp=intval($info["compiler_timestamp"]);
85 85
         }
86 86
         $latest_timestamp=$installed_timestamp;
87
-        $ConpilerConfig = glob(babel_path("Extension/$ocode/compiler/*.*"));
87
+        $ConpilerConfig=glob(babel_path("Extension/$ocode/compiler/*.*"));
88 88
         foreach ($ConpilerConfig as $file) {
89
-            if (intval(basename($file)) > $installed_timestamp) {
89
+            if (intval(basename($file))>$installed_timestamp) {
90 90
                 try {
91 91
                     $this->commitCompiler($file, json_decode(file_get_contents($file), true));
92 92
                     $latest_timestamp=intval(basename($file));
Please login to merge, or discard this patch.
app/Babel/Install/InstallerBase.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
             //writing database
40 40
             $this->transactionDB();
41 41
 
42
-        }catch(Throwable $e){
43
-            if ($e->getMessage()!==""){
42
+        } catch (Throwable $e) {
43
+            if ($e->getMessage()!=="") {
44 44
                 $this->command->line("\n  <bg=red;fg=white> {$e->getMessage()} </>\n");
45 45
             }
46 46
         }
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
     public function __construct($class)
60 60
     {
61 61
         $this->command=$class;
62
-        $this->versionParser = new VersionConstraintParser();
62
+        $this->versionParser=new VersionConstraintParser();
63 63
     }
64 64
 
65 65
     private function parseVersion()
66 66
     {
67
-        if(empty($this->babelConfig)){
67
+        if (empty($this->babelConfig)) {
68 68
             throw new Exception('Missing babel.json Config file.');
69 69
         }
70 70
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
             DB::commit();
136 136
 
137
-        }catch(Throwable $e){
137
+        } catch (Throwable $e) {
138 138
             DB::rollback();
139 139
             if ($e->getMessage()!=="") {
140 140
                 $this->command->line("\n  <bg=red;fg=white> {$e->getMessage()} </>\n");
Please login to merge, or discard this patch.
app/Models/Submission/SubmissionModel.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                                             ->where(['verdict'=>'Waiting'])
414 414
                                             ->get()
415 415
                                             ->all();
416
-        foreach($ret as &$r){
416
+        foreach ($ret as &$r) {
417 417
             $r["ocode"]=DB::table("oj")->where(["oid"=>$r["oid"]])->first()["ocode"];
418 418
         }
419 419
         return $ret;
@@ -431,15 +431,15 @@  discard block
 block discarded – undo
431 431
         if (isset($sub['verdict'])) {
432 432
             $sub["color"]=$this->colorScheme[$sub['verdict']];
433 433
         }
434
-        $result = DB::table($this->tableName)->where(['sid'=>$sid])->update($sub);
435
-        $contestModel = new ContestModel();
436
-        $submission_info = DB::table($this->tableName) -> where(['sid'=>$sid]) -> get() -> first();
437
-        if ($result==1 && $submission_info['cid'] && $contestModel->isContestRunning($submission_info['cid'])){
438
-            $sub['pid'] = $submission_info['pid'];
439
-            $sub['uid'] = $submission_info['uid'];
440
-            $sub['cid'] = $submission_info['cid'];
441
-            $sub['sid'] = $sid;
442
-            $contestModel->updateContestRankTable($submission_info['cid'],$sub);
434
+        $result=DB::table($this->tableName)->where(['sid'=>$sid])->update($sub);
435
+        $contestModel=new ContestModel();
436
+        $submission_info=DB::table($this->tableName) -> where(['sid'=>$sid]) -> get() -> first();
437
+        if ($result==1 && $submission_info['cid'] && $contestModel->isContestRunning($submission_info['cid'])) {
438
+            $sub['pid']=$submission_info['pid'];
439
+            $sub['uid']=$submission_info['uid'];
440
+            $sub['cid']=$submission_info['cid'];
441
+            $sub['sid']=$sid;
442
+            $contestModel->updateContestRankTable($submission_info['cid'], $sub);
443 443
         }
444 444
         return $result;
445 445
     }
@@ -510,15 +510,15 @@  discard block
 block discarded – undo
510 510
             'desc'
511 511
         );
512 512
 
513
-        if($filter["pcode"]){
513
+        if ($filter["pcode"]) {
514 514
             $paginator=$paginator->where(["pcode"=>$filter["pcode"]]);
515 515
         }
516 516
 
517
-        if($filter["result"]){
517
+        if ($filter["result"]) {
518 518
             $paginator=$paginator->where(["verdict"=>$filter["result"]]);
519 519
         }
520 520
 
521
-        if($filter["account"]){
521
+        if ($filter["account"]) {
522 522
             $paginator=$paginator->where(["name"=>$filter["account"]]);
523 523
         }
524 524
 
Please login to merge, or discard this patch.
app/Http/Controllers/Group/AdminController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function settings($gcode)
23 23
     {
24
-        return Redirect::route('group.settings.general', ['gcode' => $gcode]);;
24
+        return Redirect::route('group.settings.general', ['gcode' => $gcode]); ;
25 25
     }
26 26
 
27 27
     /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function settingsReturn($gcode)
33 33
     {
34
-        return Redirect::route('group.detail', ['gcode' => $gcode]);;
34
+        return Redirect::route('group.detail', ['gcode' => $gcode]); ;
35 35
     }
36 36
 
37 37
     /**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $groupModel=new GroupModel();
45 45
         $basic_info=$groupModel->details($gcode);
46
-        if(empty($basic_info)) return Redirect::route('group.index');
46
+        if (empty($basic_info)) return Redirect::route('group.index');
47 47
         $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id);
48 48
         $member_list=$groupModel->userList($basic_info["gid"]);
49 49
         return view('group.settings.general', [
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
      *
62 62
      * @return Response
63 63
      */
64
-    public function problems($gcode){
65
-        $groupModel = new GroupModel();
66
-        $group_info = $groupModel->details($gcode);
67
-        $problems = $groupModel->problems($group_info['gid']);
64
+    public function problems($gcode) {
65
+        $groupModel=new GroupModel();
66
+        $group_info=$groupModel->details($gcode);
67
+        $problems=$groupModel->problems($group_info['gid']);
68 68
         $basic_info=$groupModel->details($gcode);
69 69
         return view('group.settings.problems', [
70 70
             'page_title'=>"Group Problems",
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     {
86 86
         $groupModel=new GroupModel();
87 87
         $basic_info=$groupModel->details($gcode);
88
-        if(empty($basic_info)) return Redirect::route('group.index');
88
+        if (empty($basic_info)) return Redirect::route('group.index');
89 89
         return view('group.settings.danger', [
90 90
             'page_title'=>"Group Setting danger",
91 91
             'site_title'=>config("app.name"),
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $groupModel=new GroupModel();
105 105
         $contestModel=new ContestModel();
106 106
         $basic_info=$groupModel->details($gcode);
107
-        if(empty($basic_info)) return Redirect::route('group.index');
107
+        if (empty($basic_info)) return Redirect::route('group.index');
108 108
         $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id);
109 109
         $member_list=$groupModel->userList($basic_info["gid"]);
110 110
         $group_notice=$groupModel->detailNotice($gcode);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $groupModel=new GroupModel();
125 125
         $contestModel=new ContestModel();
126 126
         $basic_info=$groupModel->details($gcode);
127
-        if(empty($basic_info)) return Redirect::route('group.index');
127
+        if (empty($basic_info)) return Redirect::route('group.index');
128 128
         $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id);
129 129
         $contest_list=$contestModel->listForSetting($basic_info["gid"]);
130 130
         $member_list=$groupModel->userList($basic_info["gid"]);
Please login to merge, or discard this patch.
app/Http/Controllers/Ajax/GroupAdminController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 
49 49
         $groupModel=new GroupModel();
50 50
         $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id);
51
-        if ($clearance < 2) {
51
+        if ($clearance<2) {
52 52
             return ResponseModel::err(7002);
53 53
         }
54
-        $tags = $groupModel->problemTags($all_data['gid'],$all_data['pid']);
55
-        if(in_array($all_data['tag'],$tags)){
54
+        $tags=$groupModel->problemTags($all_data['gid'], $all_data['pid']);
55
+        if (in_array($all_data['tag'], $tags)) {
56 56
             return ResponseModel::err(7007);
57 57
         }
58 58
 
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
         $request->validate([
85 85
             'gid' => 'required|string',
86 86
         ]);
87
-        $gid = $request->input('gid');
87
+        $gid=$request->input('gid');
88 88
         $groupModel=new GroupModel();
89
-        if($groupModel->judgeClearance($gid,Auth::user()->id) < 2) {
89
+        if ($groupModel->judgeClearance($gid, Auth::user()->id)<2) {
90 90
             return ResponseModel::err(2001);
91 91
         }
92 92
         $groupModel->refreshElo($gid);
Please login to merge, or discard this patch.
app/Models/ProblemModel.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 
179 179
     private function inteliAudit($uid, $content)
180 180
     {
181
-        if (strpos($content, '```')!==false){
181
+        if (strpos($content, '```')!==false) {
182 182
             $userSolutionHistory=DB::table("problem_solution")->where(['uid'=>$uid])->orderByDesc('updated_at')->first();
183
-            if (!empty($userSolutionHistory) && $userSolutionHistory["audit"]==1){
183
+            if (!empty($userSolutionHistory) && $userSolutionHistory["audit"]==1) {
184 184
                 return 1;
185 185
             }
186 186
         }
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 
431 431
         if (!empty($data["sample"])) {
432 432
             foreach ($data["sample"] as $d) {
433
-                if(!isset($d['sample_note'])) $d['sample_note']=null;
433
+                if (!isset($d['sample_note'])) $d['sample_note']=null;
434 434
                 DB::table("problem_sample")->insert([
435 435
                     'pid'=>$pid,
436 436
                     'sample_input'=>$d['sample_input'],
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 
477 477
         if (!empty($data["sample"])) {
478 478
             foreach ($data["sample"] as $d) {
479
-                if(!isset($d['sample_note'])) $d['sample_note']=null;
479
+                if (!isset($d['sample_note'])) $d['sample_note']=null;
480 480
                 DB::table("problem_sample")->insert([
481 481
                     'pid'=>$pid,
482 482
                     'sample_input'=>$d['sample_input'],
Please login to merge, or discard this patch.
app/Models/JudgerModel.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             "oid"=>$oid,
60 60
             "available"=>1,
61 61
             "status"=>0
62
-        ])->orderBy('usage','desc')->get()->first();
62
+        ])->orderBy('usage', 'desc')->get()->first();
63 63
 
64 64
         return $serverList;
65 65
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $serverList=DB::table("judge_server")->where(["oid"=>$oid])->get()->all();
70 70
         foreach ($serverList as &$server) {
71
-            $server["status_parsed"]=is_null($server["status"])?self::$status["-1"]:self::$status[$server["status"]];
71
+            $server["status_parsed"]=is_null($server["status"]) ?self::$status["-1"] : self::$status[$server["status"]];
72 72
         }
73 73
         return $serverList;
74 74
     }
Please login to merge, or discard this patch.
app/Helpers/functions.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
     }
64 64
 }
65 65
 
66
-if (! function_exists('babel_path')) {
66
+if (!function_exists('babel_path')) {
67 67
     /**
68 68
      * Get the path to the application folder.
69 69
      *
70 70
      * @param  string  $path
71 71
      * @return string
72 72
      */
73
-    function babel_path($path = '')
73
+    function babel_path($path='')
74 74
     {
75 75
         return app('path').DIRECTORY_SEPARATOR.'Babel'.($path ? DIRECTORY_SEPARATOR.$path : $path);
76 76
     }
77 77
 }
78 78
 
79
-if (! function_exists('glob_recursive')) {
79
+if (!function_exists('glob_recursive')) {
80 80
     /**
81 81
      * Find pathnames matching a pattern recursively.
82 82
      *
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
      * @param  int     $flags   Valid flags: GLOB_MARK
85 85
      * @return array|false      an array containing the matched files/directories, an empty array if no file matched or false on error.
86 86
      */
87
-    function glob_recursive($pattern, $flags = 0)
87
+    function glob_recursive($pattern, $flags=0)
88 88
     {
89
-        $files = glob($pattern, $flags);
90
-        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
91
-            $files = array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags));
89
+        $files=glob($pattern, $flags);
90
+        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
91
+            $files=array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags));
92 92
         }
93 93
         return $files;
94 94
     }
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
     function delFile($dirName)
123 123
     {
124 124
         if (file_exists($dirName) && $handle=opendir($dirName)) {
125
-            while (false!==($item = readdir($handle))) {
126
-                if ($item!= "." && $item != "..") {
125
+            while (false!==($item=readdir($handle))) {
126
+                if ($item!="." && $item!="..") {
127 127
                     if (file_exists($dirName.'/'.$item) && is_dir($dirName.'/'.$item)) {
128 128
                         delFile($dirName.'/'.$item);
129 129
                     } else {
@@ -141,6 +141,6 @@  discard block
 block discarded – undo
141 141
 if (!function_exists('convertMarkdownToHtml')) {
142 142
     function convertMarkdownToHtml($md)
143 143
     {
144
-        return is_string($md)?Markdown::convertToHtml($md):'';
144
+        return is_string($md) ?Markdown::convertToHtml($md) : '';
145 145
     }
146 146
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Contest/BoardController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
             ];
107 107
         }
108 108
 
109
-        $editor_left_width = $accountModel->getExtra(Auth::user()->id, 'editor_left_width');
110
-        if(empty($editor_left_width)) $editor_left_width='40';
109
+        $editor_left_width=$accountModel->getExtra(Auth::user()->id, 'editor_left_width');
110
+        if (empty($editor_left_width)) $editor_left_width='40';
111 111
 
112 112
         return view('contest.board.editor', [
113 113
             'page_title'=>"Problem Detail",
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
 
152 152
         // To determine the ranking
153 153
         foreach ($contestRank as $i => &$r) {
154
-            if($i != 0) {
155
-                if($r['score'] == $contestRank[$i-1]['score'] && $r['penalty'] == $contestRank[$i-1]['penalty']){
156
-                    $r['rank'] = $contestRank[$i-1]['rank'];
157
-                }else{
158
-                    $r['rank'] = $i + 1;
154
+            if ($i!=0) {
155
+                if ($r['score']==$contestRank[$i-1]['score'] && $r['penalty']==$contestRank[$i-1]['penalty']) {
156
+                    $r['rank']=$contestRank[$i-1]['rank'];
157
+                } else {
158
+                    $r['rank']=$i+1;
159 159
                 }
160
-            }else{
161
-                $r['rank'] = 1;
160
+            } else {
161
+                $r['rank']=1;
162 162
             }
163 163
         }
164 164
         $rankFrozen=$contestModel->isFrozen($cid);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         ]);
279 279
     }
280 280
 
281
-    public function analysis($cid){
281
+    public function analysis($cid) {
282 282
         $contestModel=new ContestModel();
283 283
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
284 284
         if (!$clearance) {
Please login to merge, or discard this patch.