Passed
Push — master ( ed4291...cc6c44 )
by John
05:48
created
app/Babel/Install/InstallerBase.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             //writing database
39 39
             $this->transactionDB();
40 40
 
41
-        }catch(Throwable $e){
41
+        } catch(Throwable $e){
42 42
             if ($e->getMessage()!==""){
43 43
                 $this->command->line("\n  <bg=red;fg=white> {$e->getMessage()} </>\n");
44 44
             }
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
             DB::commit();
222 222
 
223
-        }catch(Throwable $e){
223
+        } catch(Throwable $e){
224 224
             DB::rollback();
225 225
             if ($e->getMessage()!=="") {
226 226
                 $this->command->line("\n  <bg=red;fg=white> {$e->getMessage()} </>\n");
Please login to merge, or discard this 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/Babel/Crawl/CrawlerBase.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
         if (!isset($data["ori"]) || !isset($data["path"]) || !isset($data["baseurl"]) || !isset($data["space_deli"]) || !isset($data["cookie"])) {
89 89
             throw new Exception("data is not completely exist in cacheImage");
90 90
         }
91
-        $ori = $data["ori"];
92
-        $path = $data["path"];
93
-        $baseurl = $data["baseurl"];
94
-        $space_deli = $data["space_deli"];
95
-        $cookie = $data["cookie"];
91
+        $ori=$data["ori"];
92
+        $path=$data["path"];
93
+        $baseurl=$data["baseurl"];
94
+        $space_deli=$data["space_deli"];
95
+        $cookie=$data["cookie"];
96 96
 
97 97
         $para["path"]=$path;
98 98
         $para["base"]=$baseurl;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             $reg="/< *im[a]?g[^>]*src *= *[\"\\']?([^\"\\'>]*)[^>]*>/si";
106 106
         }
107 107
 
108
-        return preg_replace_callback($reg, function ($matches) use ($para) {
108
+        return preg_replace_callback($reg, function($matches) use ($para) {
109 109
             global $config;
110 110
             $url=trim($matches[1]);
111 111
             if (stripos($url, "http://")===false && stripos($url, "https://")===false) {
@@ -138,24 +138,24 @@  discard block
 block discarded – undo
138 138
     public function procInfo($data)
139 139
     {
140 140
         if (isset($data["path"])) {
141
-            $path = $data["path"];
141
+            $path=$data["path"];
142 142
         } else {
143 143
             throw new Exception("path is not exist in data");
144 144
         }
145 145
         if (isset($data["baseurl"])) {
146
-            $baseurl = $data["baseurl"];
146
+            $baseurl=$data["baseurl"];
147 147
         } else {
148 148
             throw new Exception("baseurl is not exist in data");
149 149
         }
150 150
         if (isset($data["space_deli"])) {
151
-            $space_deli = $data["space_deli"];
151
+            $space_deli=$data["space_deli"];
152 152
         } else {
153
-            $space_deli = true;
153
+            $space_deli=true;
154 154
         }
155 155
         if (isset($data["cookie"])) {
156
-            $cookie = $data["cookie"];
156
+            $cookie=$data["cookie"];
157 157
         } else {
158
-            $cookie = "";
158
+            $cookie="";
159 159
         }
160 160
 
161 161
         $this->pro["description"]=$this->_cacheImage($this->pro["description"], $path, $baseurl, $space_deli, $cookie);
Please login to merge, or discard this patch.
app/Babel/Crawl/Crawler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
         } catch (ErrorException $e) {
33 33
         } catch (Exception $e) {
34 34
         }
35
-        $className = "App\\Babel\\Extension\\$name\\$crawlerProvider";
35
+        $className="App\\Babel\\Extension\\$name\\$crawlerProvider";
36 36
         if (class_exists($className)) {
37 37
             $temp=new $className();
38 38
             $temp->importCommandLine($commandLineObject);
Please login to merge, or discard this patch.
app/Babel/Monit/Monitor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         } catch (ErrorException $e) {
34 34
         } catch (Exception $e) {
35 35
         }
36
-        $className = "App\\Babel\\Extension\\$name\\$monitorProvider";
36
+        $className="App\\Babel\\Extension\\$name\\$monitorProvider";
37 37
         if (class_exists($className)) {
38 38
             return new $className();
39 39
         } else {
Please login to merge, or discard this patch.
app/Admin/Controllers/DashboardController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@
 block discarded – undo
13 13
     {
14 14
         $version=UpdateModel::checkUpdate();
15 15
 
16
-        $status = [
17
-            ['name' => 'NOJ Version',       'value' => version()],
18
-            ['name' => 'Lastest Version',       'value' => is_null($version)?'Failed to fetch latest version':$version["name"]],
19
-            ['name' => 'Problems',          'value' => \App\Models\Eloquent\ProblemModel::count()],
20
-            ['name' => 'Solutions',         'value' => \App\Models\Eloquent\ProblemSolutionModel::count()],
21
-            ['name' => 'Submissions',       'value' => \App\Models\Eloquent\SubmissionModel::count()],
22
-            ['name' => 'Contests',          'value' => \App\Models\Eloquent\ContestModel::count()],
23
-            ['name' => 'Users',             'value' => \App\Models\Eloquent\UserModel::count()],
24
-            ['name' => 'Groups',            'value' => \App\Models\Eloquent\GroupModel::count()],
16
+        $status=[
17
+            ['name' => 'NOJ Version', 'value' => version()],
18
+            ['name' => 'Lastest Version', 'value' => is_null($version) ? 'Failed to fetch latest version' : $version["name"]],
19
+            ['name' => 'Problems', 'value' => \App\Models\Eloquent\ProblemModel::count()],
20
+            ['name' => 'Solutions', 'value' => \App\Models\Eloquent\ProblemSolutionModel::count()],
21
+            ['name' => 'Submissions', 'value' => \App\Models\Eloquent\SubmissionModel::count()],
22
+            ['name' => 'Contests', 'value' => \App\Models\Eloquent\ContestModel::count()],
23
+            ['name' => 'Users', 'value' => \App\Models\Eloquent\UserModel::count()],
24
+            ['name' => 'Groups', 'value' => \App\Models\Eloquent\GroupModel::count()],
25 25
         ];
26 26
 
27 27
         return view('admin::dashboard.general', [
Please login to merge, or discard this patch.
app/Admin/Controllers/BabelController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     {
33 33
         $extensionList=ExtensionModel::list();
34 34
 
35
-        if(empty($extensionList)){
35
+        if (empty($extensionList)) {
36 36
             return redirect('/admin');
37 37
         }
38 38
 
Please login to merge, or discard this patch.
app/Admin/routes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     $router->resource('contests', ContestController::class);
18 18
     $router->resource('groups', GroupController::class);
19 19
 
20
-    Route::group(['prefix' => 'babel'], function (Router $router) {
20
+    Route::group(['prefix' => 'babel'], function(Router $router) {
21 21
         $router->get('/', 'BabelController@index');
22 22
     });
23 23
 
Please login to merge, or discard this patch.
app/Http/Controllers/SearchController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@
 block discarded – undo
19 19
             'site_title' => config("app.name"),
20 20
             'navigation' => null,
21 21
             'search_key' => $request->input('q'),
22
-            'search_category' => $request->input('tab','problems'),
23
-            'page' => $request->input('page',1)
22
+            'search_category' => $request->input('tab', 'problems'),
23
+            'page' => $request->input('page', 1)
24 24
         ]);
25 25
     }
26 26
 }
Please login to merge, or discard this patch.
app/Console/Kernel.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     protected function schedule(Schedule $schedule)
35 35
     {
36
-        $schedule->call(function () {
36
+        $schedule->call(function() {
37 37
             $babel=new Babel();
38 38
             for ($i=1; $i<=12; $i++) {
39 39
                 $babel->judge();
@@ -42,62 +42,62 @@  discard block
 block discarded – undo
42 42
             // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Synced Judger");
43 43
         })->everyMinute()->description("Sync Judger");
44 44
 
45
-        $schedule->call(function () {
45
+        $schedule->call(function() {
46 46
             $rankModel=new RankModel();
47 47
             $rankModel->rankList();
48 48
             // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Updated Rank");
49 49
         })->dailyAt('02:00')->description("Update Rank");
50 50
 
51
-        $schedule->call(function () {
51
+        $schedule->call(function() {
52 52
             $siteMapModel=new SiteMapModel();
53 53
             // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Updated SiteMap");
54 54
         })->dailyAt('02:00')->description("Update SiteMap");
55 55
 
56
-        $schedule->call(function () {
56
+        $schedule->call(function() {
57 57
             $groupModel=new GroupModel();
58 58
             $groupModel->cacheTrendingGroups();
59 59
             // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Cached Trending Groups");
60 60
         })->dailyAt('03:00')->description("Update Trending Groups");
61 61
 
62
-        $schedule->call(function () {
63
-            $contestModel = new ContestModel();
64
-            $syncList = $contestModel->runningContest();
62
+        $schedule->call(function() {
63
+            $contestModel=new ContestModel();
64
+            $syncList=$contestModel->runningContest();
65 65
             foreach ($syncList as $syncContest) {
66 66
                 if (!isset($syncContest['vcid'])) {
67 67
                     $contestRankRaw=$contestModel->contestRankCache($syncContest['cid']);
68 68
                     $cid=$syncContest['cid'];
69 69
                     Cache::tags(['contest', 'rank'])->put($cid, $contestRankRaw);
70 70
                     Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $contestRankRaw);
71
-                    continue ;
71
+                    continue;
72 72
                 }
73
-                $className = "App\\Babel\\Extension\\hdu\\Synchronizer";  // TODO Add OJ judgement.
74
-                $all_data = [
73
+                $className="App\\Babel\\Extension\\hdu\\Synchronizer"; // TODO Add OJ judgement.
74
+                $all_data=[
75 75
                     'oj'=>"hdu",
76 76
                     'vcid'=>$syncContest['vcid'],
77 77
                     'gid'=>$syncContest['gid'],
78 78
                     'cid'=>$syncContest['cid'],
79 79
                 ];
80
-                $hduSync = new $className($all_data);
80
+                $hduSync=new $className($all_data);
81 81
                 $hduSync->crawlRank();
82 82
                 $hduSync->crawlClarification();
83 83
             }
84 84
             // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Synced Remote Rank and Clarification");
85 85
         })->everyMinute()->description("Sync Remote Rank and Clarification");
86 86
 
87
-        $schedule->call(function () {
88
-            $contestModel = new ContestModel();
89
-            $syncList = $contestModel->runningContest();
87
+        $schedule->call(function() {
88
+            $contestModel=new ContestModel();
89
+            $syncList=$contestModel->runningContest();
90 90
             foreach ($syncList as $syncContest) {
91 91
                 if (isset($syncContest['crawled'])) {
92 92
                     if (!$syncContest['crawled']) {
93
-                        $className = "App\\Babel\\Extension\\hdu\\Synchronizer";
94
-                        $all_data = [
93
+                        $className="App\\Babel\\Extension\\hdu\\Synchronizer";
94
+                        $all_data=[
95 95
                             'oj'=>"hdu",
96 96
                             'vcid'=>$syncContest['vcid'],
97 97
                             'gid'=>$syncContest['gid'],
98 98
                             'cid'=>$syncContest['cid'],
99 99
                         ];
100
-                        $hduSync = new $className($all_data);
100
+                        $hduSync=new $className($all_data);
101 101
                         $hduSync->scheduleCrawl();
102 102
                         $contestModel->updateCrawlStatus($syncContest['cid']);
103 103
                     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             }
106 106
         })->everyMinute()->description("Sync Contest Problem");
107 107
 
108
-        $schedule->call(function () {
108
+        $schedule->call(function() {
109 109
             $oidList=EloquentJudgeServerModel::column('oid');
110 110
             $babel=new Babel();
111 111
             foreach ($oidList as $oid) {
Please login to merge, or discard this patch.