Passed
Pull Request — master (#648)
by John
06:12
created
app/Admin/Controllers/DojoController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -148,8 +148,8 @@
 block discarded – undo
148 148
             $form->number('order', __('admin.dojos.order'))->default(0)->rules('required');
149 149
             $form->multipleSelect('precondition', __('admin.dojos.precondition'))->options(Dojo::all()->pluck('name', 'id'));
150 150
             $form->hasMany('problems', __('admin.dojos.problems'), function(Form\NestedForm $form) {
151
-                $form->select('problem_id', __('admin.dojos.problem'))->options(function ($pid) {
152
-                    $problem = Problem::find($pid);
151
+                $form->select('problem_id', __('admin.dojos.problem'))->options(function($pid) {
152
+                    $problem=Problem::find($pid);
153 153
                     if ($problem) {
154 154
                         return [$problem->pid => $problem->readable_name];
155 155
                     }
Please login to merge, or discard this patch.
app/Admin/Controllers/GroupController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,8 +139,8 @@
 block discarded – undo
139 139
             ])->default(1);
140 140
             $form->image('img', 'Custom Group Focus Image')->uniqueName()->move("static/img/group");
141 141
             if ($form->isCreating()) {
142
-                $form->select('leader_uid', 'Group Leader')->options(function ($id) {
143
-                    $user = User::find($id);
142
+                $form->select('leader_uid', 'Group Leader')->options(function($id) {
143
+                    $user=User::find($id);
144 144
                     if ($user) {
145 145
                         return [$user->id => $user->readable_name];
146 146
                     }
Please login to merge, or discard this patch.
app/Admin/Controllers/ContestController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
         $form=new Form(new Contest);
138 138
         $form->tab('Basic', function(Form $form) {
139 139
             $form->select('gid', 'Contest Creator Group')->options(Group::all()->pluck('name', 'gid'))->required();
140
-            $form->select('assign_uid', 'Contest Assign User')->options(function ($id) {
141
-                $user = User::find($id);
140
+            $form->select('assign_uid', 'Contest Assign User')->options(function($id) {
141
+                $user=User::find($id);
142 142
                 if ($user) {
143 143
                     return [$user->id => $user->readable_name];
144 144
                 }
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
                     $ncodeArr[$alpha]=$alpha;
211 211
                 }
212 212
                 $form->select('ncode', 'Problem Alphabetical Index')->options($ncodeArr)->default("A")->required();
213
-                $form->select('pid', 'Problem')->options(function ($pid) {
214
-                    $problem = Problem::find($pid);
213
+                $form->select('pid', 'Problem')->options(function($pid) {
214
+                    $problem=Problem::find($pid);
215 215
                     if ($problem) {
216 216
                         return [$problem->pid => $problem->readable_name];
217 217
                     }
Please login to merge, or discard this patch.
app/Admin/Controllers/ProblemController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     public function show($id, Content $content)
45 45
     {
46 46
         $problem=Problem::findOrFail($id);
47
-        if(!$problem->markdown || $problem->onlinejudge->ocode !== 'noj'){
47
+        if (!$problem->markdown || $problem->onlinejudge->ocode!=='noj') {
48 48
             return abort('403', 'Problem managed by BABEL cannot be accessed by Admin Portal.');
49 49
         }
50 50
         return $content
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function edit($id, Content $content)
64 64
     {
65 65
         $problem=Problem::findOrFail($id);
66
-        if(!$problem->markdown || $problem->onlinejudge->ocode !== 'noj'){
66
+        if (!$problem->markdown || $problem->onlinejudge->ocode!=='noj') {
67 67
             return abort('403', 'Problem managed by BABEL cannot be accessed by Admin Portal.');
68 68
         }
69 69
         return $content
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $grid->model()->where([
112 112
             'markdown'=>1,
113 113
             'OJ'=>OJ::where(['ocode'=>'noj'])->first()->oid,
114
-        ])->orderBy('pcode','asc');
114
+        ])->orderBy('pcode', 'asc');
115 115
         $grid->column('pid', "ID")->sortable();
116 116
         $grid->column('pcode', "PCode")->editable()->sortable();
117 117
         $grid->title("Title")->editable();
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
                     1 => 'YES',
206 206
                 ])->default(0)->rules('required');
207 207
             $form->clang('spj_src', 'SPJ Source Code');
208
-            if($form->isCreating()) {
208
+            if ($form->isCreating()) {
209 209
                 $form->chunk_file('test_case')->rules('required');
210 210
             } else {
211 211
                 $form->chunk_file('test_case');
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
                 return $err('The SPJ problem must provide spj_src', 'create problem error');
252 252
             }
253 253
 
254
-            $test_case = null;
254
+            $test_case=null;
255 255
 
256
-            if(!is_null(request()->get('test_case'))) {
257
-                $test_case = explode('http://fake.path/',request()->get('test_case'), 2)[1];
256
+            if (!is_null(request()->get('test_case'))) {
257
+                $test_case=explode('http://fake.path/', request()->get('test_case'), 2)[1];
258 258
                 $path=Storage::disk('temp')->path($test_case);
259 259
 
260
-                if (pathinfo($path, PATHINFO_EXTENSION) !== 'zip') {
260
+                if (pathinfo($path, PATHINFO_EXTENSION)!=='zip') {
261 261
                     return $err('You must upload a zip file iuclude test case info and content.');
262 262
                 }
263 263
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
                             $files[]=$filename;
282 282
                         }
283 283
                         $files_in=array_filter($files, function($filename) {
284
-                            return pathinfo($filename, PATHINFO_EXTENSION) == 'in';
284
+                            return pathinfo($filename, PATHINFO_EXTENSION)=='in';
285 285
                         });
286 286
                         sort($files_in);
287 287
                         $testcase_index=1;
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
                             $files[]=$filename;
317 317
                         }
318 318
                         $files_in=array_filter($files, function($filename) {
319
-                            return pathinfo($filename, PATHINFO_EXTENSION) == 'in';
319
+                            return pathinfo($filename, PATHINFO_EXTENSION)=='in';
320 320
                         });
321 321
                         sort($files_in);
322 322
                         $testcase_index=1;
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                 $form->spj_version="{$form->pcode}#".time();
377 377
             }
378 378
             //Set default data
379
-            if($form->isCreating() && empty($test_case)) {
379
+            if ($form->isCreating() && empty($test_case)) {
380 380
                 $form->tot_score=0;
381 381
             }
382 382
             $form->markdown=true;
Please login to merge, or discard this patch.
app/Admin/Controllers/ApiController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -10,21 +10,21 @@  discard block
 block discarded – undo
10 10
 
11 11
 class ApiController extends AdminController
12 12
 {
13
-    protected function paginate($items, $perPage = 15, $pageStart = 1)
13
+    protected function paginate($items, $perPage=15, $pageStart=1)
14 14
     {
15
-        $offSet = ($pageStart * $perPage) - $perPage;
16
-        $itemsForCurrentPage = array_slice($items, $offSet, $perPage, true);
17
-        $paginator = new LengthAwarePaginator($itemsForCurrentPage, count($items), $perPage, Paginator::resolveCurrentPage(), ['path' => Paginator::resolveCurrentPath()]);
15
+        $offSet=($pageStart * $perPage)-$perPage;
16
+        $itemsForCurrentPage=array_slice($items, $offSet, $perPage, true);
17
+        $paginator=new LengthAwarePaginator($itemsForCurrentPage, count($items), $perPage, Paginator::resolveCurrentPage(), ['path' => Paginator::resolveCurrentPath()]);
18 18
         return $paginator;
19 19
     }
20 20
 
21 21
     public function problems()
22 22
     {
23
-        $q = request()->q;
23
+        $q=request()->q;
24 24
 
25
-        return $this->paginate(Problem::orderBy('pcode', 'asc')->get()->filter(function ($problem) use ($q) {
26
-            return stripos($problem->readable_name, $q) !== false;
27
-        })->values()->transform(function ($problem) {
25
+        return $this->paginate(Problem::orderBy('pcode', 'asc')->get()->filter(function($problem) use ($q) {
26
+            return stripos($problem->readable_name, $q)!==false;
27
+        })->values()->transform(function($problem) {
28 28
             return [
29 29
                 'id' => $problem->pid,
30 30
                 'text' => $problem->readable_name,
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 
35 35
     public function users()
36 36
     {
37
-        $q = request()->q;
37
+        $q=request()->q;
38 38
 
39
-        return $this->paginate(User::get()->filter(function ($user) use ($q) {
40
-            return stripos($user->readable_name, $q) !== false;
41
-        })->values()->transform(function ($user) {
39
+        return $this->paginate(User::get()->filter(function($user) use ($q) {
40
+            return stripos($user->readable_name, $q)!==false;
41
+        })->values()->transform(function($user) {
42 42
             return [
43 43
                 'id' => $user->id,
44 44
                 'text' => $user->readable_name,
Please login to merge, or discard this patch.
app/Admin/Controllers/AnnouncementController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 
94 94
         $grid->filter(function(Grid\Filter $filter) {
95 95
             $filter->like('title', __('admin.announcements.title'));
96
-            $filter->equal('uid', __('admin.announcements.user'))->select(function ($id) {
97
-                $user = User::find($id);
96
+            $filter->equal('uid', __('admin.announcements.user'))->select(function($id) {
97
+                $user=User::find($id);
98 98
                 if ($user) {
99 99
                     return [$user->id => $user->readable_name];
100 100
                 }
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
         $form=new Form(new Announcement());
135 135
         $form->text('title', __('admin.announcements.title'))->required();
136 136
         $form->simplemde('content', __('admin.announcements.content'))->help(__('admin.announcements.help.markdown'))->required();
137
-        $form->select('uid', __('admin.announcements.user'))->options(function ($id) {
138
-            $user = User::find($id);
137
+        $form->select('uid', __('admin.announcements.user'))->options(function($id) {
138
+            $user=User::find($id);
139 139
             if ($user) {
140 140
                 return [$user->id => $user->readable_name];
141 141
             }
Please login to merge, or discard this patch.
app/Admin/Controllers/SubmissionController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -123,14 +123,14 @@  discard block
 block discarded – undo
123 123
             });
124 124
             $filter->column(6, function($filter) {
125 125
                 $filter->equal('cid', __('admin.submissions.cid'))->select(Contest::all()->pluck('name', 'cid'));
126
-                $filter->equal('uid', __('admin.submissions.uid'))->select(function ($id) {
127
-                    $user = User::find($id);
126
+                $filter->equal('uid', __('admin.submissions.uid'))->select(function($id) {
127
+                    $user=User::find($id);
128 128
                     if ($user) {
129 129
                         return [$user->id => $user->readable_name];
130 130
                     }
131 131
                 })->config('minimumInputLength', 4)->ajax(route('admin.api.users'));
132
-                $filter->equal('pid', __('admin.submissions.pid'))->select(function ($pid) {
133
-                    $problem = Problem::find($pid);
132
+                $filter->equal('pid', __('admin.submissions.pid'))->select(function($pid) {
133
+                    $problem=Problem::find($pid);
134 134
                     if ($problem) {
135 135
                         return [$problem->pid => $problem->readable_name];
136 136
                     }
@@ -226,15 +226,15 @@  discard block
 block discarded – undo
226 226
             $form->text('color', __('admin.submissions.color'))->rules('required');
227 227
             $form->textarea('language', __('admin.submissions.language'))->rules('required');
228 228
             $form->display('submission_date', __('admin.submissions.submission_date'));
229
-            $form->select('uid', __('admin.submissions.uid'))->options(function ($id) {
230
-                $user = User::find($id);
229
+            $form->select('uid', __('admin.submissions.uid'))->options(function($id) {
230
+                $user=User::find($id);
231 231
                 if ($user) {
232 232
                     return [$user->id => $user->readable_name];
233 233
                 }
234 234
             })->config('minimumInputLength', 4)->ajax(route('admin.api.users'))->required();
235 235
             $form->select('cid', __('admin.submissions.cid'))->options(Contest::all()->pluck('name', 'cid'));
236
-            $form->select('pid', __('admin.submissions.pid'))->options(function ($pid) {
237
-                $problem = Problem::find($pid);
236
+            $form->select('pid', __('admin.submissions.pid'))->options(function($pid) {
237
+                $problem=Problem::find($pid);
238 238
                 if ($problem) {
239 239
                     return [$problem->pid => $problem->readable_name];
240 240
                 }
Please login to merge, or discard this patch.
app/Admin/Controllers/DojoPassesController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
                 $filter->equal('dojo_id', __('admin.dojopasses.dojo'))->select(Dojo::all()->pluck('name', 'id'));
99 99
             });
100 100
             $filter->column(6, function($filter) {
101
-                $filter->equal('user_id', __('admin.dojopasses.user'))->select(function ($id) {
102
-                    $user = User::find($id);
101
+                $filter->equal('user_id', __('admin.dojopasses.user'))->select(function($id) {
102
+                    $user=User::find($id);
103 103
                     if ($user) {
104 104
                         return [$user->id => $user->readable_name];
105 105
                     }
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
         $form->tab('Basic', function(Form $form) {
141 141
             $form->display('id', 'ID');
142 142
             $form->select('dojo_id', __('admin.dojopasses.dojo'))->options(Dojo::all()->pluck('name', 'id'))->rules('required');
143
-            $form->select('user_id', __('admin.dojopasses.user'))->options(function ($id) {
144
-                $user = User::find($id);
143
+            $form->select('user_id', __('admin.dojopasses.user'))->options(function($id) {
144
+                $user=User::find($id);
145 145
                 if ($user) {
146 146
                     return [$user->id => $user->readable_name];
147 147
                 }
Please login to merge, or discard this patch.
app/Admin/Controllers/SolutionController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -129,14 +129,14 @@
 block discarded – undo
129 129
         $form->model()->makeVisible('password');
130 130
         $form->tab('Basic', function(Form $form) {
131 131
             $form->display("psoid");
132
-            $form->select('uid', 'Author')->options(function ($id) {
133
-                $user = User::find($id);
132
+            $form->select('uid', 'Author')->options(function($id) {
133
+                $user=User::find($id);
134 134
                 if ($user) {
135 135
                     return [$user->id => $user->readable_name];
136 136
                 }
137 137
             })->config('minimumInputLength', 4)->ajax(route('admin.api.users'))->required();
138
-            $form->select('pid', 'Problem')->options(function ($pid) {
139
-                $problem = Problem::find($pid);
138
+            $form->select('pid', 'Problem')->options(function($pid) {
139
+                $problem=Problem::find($pid);
140 140
                 if ($problem) {
141 141
                     return [$problem->pid => $problem->readable_name];
142 142
                 }
Please login to merge, or discard this patch.