Passed
Pull Request — master (#184)
by Chenyi
03:56
created
app/Babel/Crawl/Crawler.php 1 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, $commandLineObject=null)
18 18
     {
19 19
         $crawler=self::create($conf, $commandLineObject);
20
-        if (!is_null($crawler) && isset($crawler)) $crawler->start($conf);
20
+        if (!is_null($crawler) && isset($crawler)) {
21
+            $crawler->start($conf);
22
+        }
21 23
     }
22 24
 
23 25
     public static function create($conf, $commandLineObject=null) {
Please login to merge, or discard this patch.
app/Exports/GroupAnalysisExport.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
         if($config['mode'] == 'contest'){
21 21
             $this->contest_data = $data['contest_data'];
22 22
             $this->member_data = $data['member_data'];
23
-        }else{
23
+        } else{
24 24
             $this->member_data = $data['member_data'];
25 25
             $this->tag_problems = $data['tag_problems'];
26 26
         }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                                     : ($maxium === 'true' ? $contest_detial['solved'].' / '.$contest_detial['problems'] : $contest_detial['solved']),
84 84
                             round($contest_detial['penalty'])
85 85
                         );
86
-                    }else{
86
+                    } else{
87 87
                         array_push(
88 88
                             $row,
89 89
                             $percent === 'true' ? '- %'
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                 }
95 95
                 array_push($data,$row);
96 96
             }
97
-        }else{
97
+        } else{
98 98
             $row_1 = ['Member'];
99 99
             $row_2 = [''];
100 100
             foreach ($this->tag_problems as $tag => $tag_problem_set) {
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
                     if($column[1] > 25){
139 139
                         if(isset($column[2])){
140 140
                             $column[2] += 1;
141
-                        }else{
141
+                        } else{
142 142
                             $column[2] = 0;
143 143
                         }
144 144
                     }
145
-                }else{
145
+                } else{
146 146
                     $column[1] = 0;
147 147
                 }
148 148
             }
Please login to merge, or discard this patch.
app/Http/Controllers/OAuth/GithubController.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     {
43 43
         try{
44 44
             $github_user = Socialite::driver('github')->user();
45
-        }catch(\Laravel\Socialite\Two\InvalidStateException $e){
45
+        } catch(\Laravel\Socialite\Two\InvalidStateException $e){
46 46
             return redirect('/');
47 47
         }
48 48
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                     ],
87 87
                 ]
88 88
             ]);
89
-        }else{
89
+        } else{
90 90
             $ret = $accountModel->findExtra('github_id',$github_user->id);
91 91
             if(!empty($ret)){
92 92
                 Auth::loginUsingId($ret['uid']);
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
                 $accountModel->setExtra($user_id,'github_homepage',($github_user->user)['html_url']);
97 97
                 $accountModel->setExtra($user_id,'github_token',$github_user->token,101);
98 98
                 return redirect('/');
99
-            }else{
99
+            } else{
100 100
                 return view('oauth.index',[
101 101
                     'page_title'=>"OAuth",
102 102
                     'site_title'=>config("app.name"),
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                     ],
144 144
                 ]
145 145
             ]);
146
-        }else{
146
+        } else{
147 147
             return view('oauth.index',[
148 148
                 'page_title'=>"OAuth",
149 149
                 'site_title'=>config("app.name"),
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
                     ],
184 184
                 ]
185 185
             ]);
186
-        }else{
186
+        } else{
187 187
             return view('oauth.index',[
188 188
                 'page_title'=>"OAuth",
189 189
                 'site_title'=>config("app.name"),
Please login to merge, or discard this patch.
app/Http/Controllers/Ajax/GroupController.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -301,11 +301,17 @@  discard block
 block discarded – undo
301 301
 
302 302
         $groupModel=new GroupModel();
303 303
         $is_user=$groupModel->isUser($all_data["email"]);
304
-        if(!$is_user) return ResponseModel::err(2006);
304
+        if(!$is_user) {
305
+            return ResponseModel::err(2006);
306
+        }
305 307
         $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id);
306
-        if($clearance<2) return ResponseModel::err(7002);
308
+        if($clearance<2) {
309
+            return ResponseModel::err(7002);
310
+        }
307 311
         $targetClearance=$groupModel->judgeEmailClearance($all_data["gid"], $all_data["email"]);
308
-        if($targetClearance!=-3) return ResponseModel::err(7003);
312
+        if($targetClearance!=-3) {
313
+            return ResponseModel::err(7003);
314
+        }
309 315
         $groupModel->inviteMember($all_data["gid"], $all_data["email"]);
310 316
         return ResponseModel::success(200);
311 317
     }
@@ -323,9 +329,13 @@  discard block
 block discarded – undo
323 329
         $all_data=$request->all();
324 330
 
325 331
         $groupModel=new GroupModel();
326
-        if($all_data["gcode"]=="create") return ResponseModel::err(7005);
332
+        if($all_data["gcode"]=="create") {
333
+            return ResponseModel::err(7005);
334
+        }
327 335
         $is_group=$groupModel->isGroup($all_data["gcode"]);
328
-        if($is_group) return ResponseModel::err(7006);
336
+        if($is_group) {
337
+            return ResponseModel::err(7006);
338
+        }
329 339
 
330 340
         $allow_extension=['jpg', 'png', 'jpeg', 'gif', 'bmp'];
331 341
         if (!empty($request->file('img')) && $request->file('img')->isValid()) {
Please login to merge, or discard this patch.
app/Http/Controllers/Ajax/ContestController.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
         $clearance = $contestModel->judgeClearance($cid,Auth::user()->id);
58 58
         if($assign_uid != 0){
59 59
             $assignee = $groupModel->userProfile($assign_uid,$contest_detail['gid']);
60
-        }else{
60
+        } else{
61 61
             $assignee = null;
62 62
         }
63 63
         $ret = [
Please login to merge, or discard this patch.
app/Http/Controllers/ContestController.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -187,7 +187,9 @@  discard block
 block discarded – undo
187 187
         }
188 188
 
189 189
         $editor_left_width = $accountModel->getExtra(Auth::user()->id, 'editor_left_width');
190
-        if(empty($editor_left_width)) $editor_left_width='40';
190
+        if(empty($editor_left_width)) {
191
+            $editor_left_width='40';
192
+        }
191 193
 
192 194
         return view('contest.board.editor', [
193 195
             'page_title'=>"Problem Detail",
@@ -383,7 +385,7 @@  discard block
 block discarded – undo
383 385
         $account=$contestModel->getContestAccount($cid);
384 386
         if($account==null){
385 387
             return ;
386
-        }else{
388
+        } else{
387 389
             $AccountExport=new AccountExport($account);
388 390
             $filename="ContestAccount$cid";
389 391
             return Excel::download($AccountExport, $filename.'.xlsx');
Please login to merge, or discard this patch.
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/Console/Commands/Babel/Install.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         $installerProvider="Installer";
46 46
         try {
47 47
             $BabelConfig=json_decode(file_get_contents(babel_path("Extension/$extension/babel.json")), true);
48
-        }catch(Exception $e){
48
+        } catch(Exception $e){
49 49
             $this->line("\n  <bg=red;fg=white> Exception </> : <fg=yellow>babel.json parse error, The extension may not exist.</>\n");
50 50
             if($this->confirm("Would you like to download it from the marketspace first?")){
51 51
                 $this->call("babel:require", ['extension' => $extension]);
Please login to merge, or discard this patch.
app/Console/Commands/Babel/Update.php 1 patch
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $this->line("Updating <fg=green>$extension</>");
46 46
         try {
47 47
             $BabelConfig=json_decode(file_get_contents(babel_path("Extension/$extension/babel.json")), true);
48
-        }catch(Exception $e){
48
+        } catch(Exception $e){
49 49
             $this->line("\n  <bg=red;fg=white> Exception </> : <fg=yellow>babel.json parse error, The extension may not exist.</>\n");
50 50
             if($this->confirm("Would you like to download it from the marketspace first?")){
51 51
                 $this->call("babel:require", ['extension' => $extension]);
@@ -68,19 +68,27 @@  discard block
 block discarded – undo
68 68
 
69 69
     private function backup($extension)
70 70
     {
71
-        if(!is_dir(babel_path("Tmp/backup/"))) mkdir(babel_path("Tmp/backup/"));
72
-        if(is_dir(babel_path("Tmp/backup/$extension/"))) $this->delDir(babel_path("Tmp/backup/$extension/"));
71
+        if(!is_dir(babel_path("Tmp/backup/"))) {
72
+            mkdir(babel_path("Tmp/backup/"));
73
+        }
74
+        if(is_dir(babel_path("Tmp/backup/$extension/"))) {
75
+            $this->delDir(babel_path("Tmp/backup/$extension/"));
76
+        }
73 77
         rename(babel_path("Extension/$extension/"), babel_path("Tmp/backup/$extension/"));
74 78
     }
75 79
 
76 80
     private function roolbackBackup($extension)
77 81
     {
78
-        if(is_dir(babel_path("Extension/$extension/"))) $this->delDir(babel_path("Extension/$extension/"));
82
+        if(is_dir(babel_path("Extension/$extension/"))) {
83
+            $this->delDir(babel_path("Extension/$extension/"));
84
+        }
79 85
         rename(babel_path("Tmp/backup/$extension/"), babel_path("Extension/$extension/"));
80 86
     }
81 87
 
82 88
     private function delDir($dir){
83
-        if(!is_dir($dir)) return;
89
+        if(!is_dir($dir)) {
90
+            return;
91
+        }
84 92
         $it = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS);
85 93
         $files = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST);
86 94
         foreach($files as $file) {
Please login to merge, or discard this patch.