Passed
Push — master ( 8da287...1d9c49 )
by Ferry
04:31 queued 01:29
created
src/routes.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
     if (Request::is(cbConfig('ADMIN_PATH'))) {
50 50
         if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) {
51 51
             Route::get("/", $dashboard);
52
-        }else{
52
+        } else{
53 53
             Route::get("/", "crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex");
54 54
         }
55 55
     }
Please login to merge, or discard this patch.
src/controllers/DeveloperRolesController.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     private function existsPrivilege($cb_roles_id, $cb_menus_id) {
81 81
         if($row = cb()->find("cb_role_privileges",['cb_roles_id'=>$cb_roles_id,'cb_menus_id'=>$cb_menus_id])) {
82 82
             return $row->id;
83
-        }else{
83
+        } else{
84 84
             return null;
85 85
         }
86 86
     }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                 $privilege["can_delete"] = $menu['can_delete']?:0;
103 103
                 if($privilege_id = $this->existsPrivilege($id, $menus_id)) {
104 104
                     DB::table("cb_role_privileges")->where("id", $privilege_id)->update($privilege);
105
-                }else{
105
+                } else{
106 106
                     DB::table("cb_role_privileges")->insert($privilege);
107 107
                 }
108 108
             }
Please login to merge, or discard this patch.
src/controllers/scaffolding/singletons/ColumnSingleton.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
                 foreach($column->getValue() as $key=>$val) {
110 110
                     $data[$key] = $val;
111 111
                 }
112
-            }else{
112
+            } else{
113 113
                 $data[$column->getField()] = $column->getValue();
114 114
             }
115 115
         }
Please login to merge, or discard this patch.
src/controllers/CBController.php 1 patch
Braces   +27 added lines, -11 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         if($method == "getData") {
33 33
             $key = $parameters[0];
34 34
             return $this->data[$key];
35
-        }else{
35
+        } else{
36 36
             return null;
37 37
         }
38 38
     }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         {
74 74
             if(isset($this->data['hook_search_query'])) {
75 75
                 $query = call_user_func($this->data['hook_search_query'], $query);
76
-            }else{
76
+            } else{
77 77
                 $query->where(function ($where) use ($columns) {
78 78
                     /**
79 79
                      * @var $where Builder
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) {
97 97
                 $query->orderBy(request('order_by'), request('order_sort'));
98 98
             }
99
-        }else{
99
+        } else{
100 100
             $query->orderBy($this->data['order_by'][0], $this->data['order_by'][1]);
101 101
         }
102 102
 
@@ -105,7 +105,9 @@  discard block
 block discarded – undo
105 105
 
106 106
     public function getIndex()
107 107
     {
108
-        if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
108
+        if(!module()->canBrowse()) {
109
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
110
+        }
109 111
 
110 112
         $query = $this->repository();
111 113
         $result = $query->paginate(20);
@@ -144,7 +146,9 @@  discard block
 block discarded – undo
144 146
 
145 147
     public function getAdd()
146 148
     {
147
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
149
+        if(!module()->canCreate()) {
150
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
151
+        }
148 152
 
149 153
         $data = [];
150 154
         $data['page_title'] = $this->data['page_title'].' : Add';
@@ -155,7 +159,9 @@  discard block
 block discarded – undo
155 159
 
156 160
     public function postAddSave()
157 161
     {
158
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
162
+        if(!module()->canCreate()) {
163
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
164
+        }
159 165
 
160 166
         try {
161 167
             $this->validation();
@@ -189,7 +195,9 @@  discard block
 block discarded – undo
189 195
 
190 196
     public function getEdit($id)
191 197
     {
192
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
198
+        if(!module()->canUpdate()) {
199
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
200
+        }
193 201
 
194 202
         $data = [];
195 203
         $data['row'] = $this->repository()->where(getPrimaryKey($this->data['table']), $id)->first();
@@ -201,7 +209,9 @@  discard block
 block discarded – undo
201 209
 
202 210
     public function postEditSave($id)
203 211
     {
204
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
212
+        if(!module()->canUpdate()) {
213
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
214
+        }
205 215
 
206 216
         try {
207 217
             $this->validation();
@@ -241,7 +251,9 @@  discard block
 block discarded – undo
241 251
 
242 252
     public function getDelete($id)
243 253
     {
244
-        if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
254
+        if(!module()->canDelete()) {
255
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
256
+        }
245 257
 
246 258
         if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
247 259
             call_user_func($this->data['hook_before_delete'], $id);
@@ -268,7 +280,9 @@  discard block
 block discarded – undo
268 280
 
269 281
     public function getDetail($id)
270 282
     {
271
-        if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
283
+        if(!module()->canRead()) {
284
+            return cb()->redirect(cb()->getAdminUrl(),"You do not have access to this area");
285
+        }
272 286
 
273 287
         $data = [];
274 288
         $data['row'] = $this->repository()->where(getPrimaryKey($this->data['table']), $id)->first();
@@ -279,7 +293,9 @@  discard block
 block discarded – undo
279 293
 
280 294
     public function postUploadFile()
281 295
     {
282
-        if(auth()->guest()) return redirect(getAdminLoginURL());
296
+        if(auth()->guest()) {
297
+            return redirect(getAdminLoginURL());
298
+        }
283 299
 
284 300
         $file = null;
285 301
         try {
Please login to merge, or discard this patch.
src/controllers/AdminProfileController.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
                 $data['photo'] = cb()->uploadFile('photo', true, 200, 200);
32 32
             }
33 33
             DB::table("users")->where("id", auth()->id())->update($data);
34
-        }catch (\Exception $e) {
34
+        } catch (\Exception $e) {
35 35
             Log::error($e);
36 36
             return cb()->redirectBack("Something went wrong!","warning");
37 37
         }
Please login to merge, or discard this patch.
src/controllers/AdminAuthController.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@  discard block
 block discarded – undo
7 7
 
8 8
     public function getLogin()
9 9
     {
10
-        if(!auth()->guest()) return redirect(getAdminURL());
10
+        if(!auth()->guest()) {
11
+            return redirect(getAdminURL());
12
+        }
11 13
 
12 14
         cbHook()->hookGetLogin();
13 15
 
@@ -28,7 +30,7 @@  discard block
 block discarded – undo
28 30
             } else {
29 31
                 return redirect(getAdminLoginURL())->with(['message'=>__('crudbooster.alert_password_wrong'),'message_type'=>'warning']);
30 32
             }
31
-        }catch (CBValidationException $e) {
33
+        } catch (CBValidationException $e) {
32 34
             return cb()->redirect(getAdminLoginURL(),$e->getMessage(),'warning');
33 35
         }
34 36
     }
@@ -57,11 +59,11 @@  discard block
 block discarded – undo
57 59
 
58 60
                 return redirect(cb()->getDeveloperUrl());
59 61
 
60
-            }else{
62
+            } else{
61 63
                 return cb()->redirectBack("Username and or password is wrong!");
62 64
             }
63 65
 
64
-        }catch (CBValidationException $e) {
66
+        } catch (CBValidationException $e) {
65 67
             return cb()->redirect(getAdminLoginURL(),$e->getMessage(),'warning');
66 68
         }
67 69
     }
Please login to merge, or discard this patch.
src/helpers/Module.php 1 patch
Braces   +37 added lines, -22 removed lines patch added patch discarded remove patch
@@ -60,45 +60,60 @@  discard block
 block discarded – undo
60 60
 
61 61
     public function canBrowse() {
62 62
         if($this->privilege) {
63
-            if($this->privilege->can_browse) return true;
64
-            else return false;
65
-        }else{
63
+            if($this->privilege->can_browse) {
64
+                return true;
65
+            } else {
66
+                return false;
67
+            }
68
+        } else{
66 69
             return true;
67 70
         }
68 71
     }
69 72
 
70 73
     public function canCreate() {
71 74
         if($this->privilege) {
72
-            if($this->privilege->can_create) return true;
73
-            else return false;
74
-        }else{
75
+            if($this->privilege->can_create) {
76
+                return true;
77
+            } else {
78
+                return false;
79
+            }
80
+        } else{
75 81
             return true;
76 82
         }
77 83
     }
78 84
 
79 85
     public function canRead() {
80 86
         if($this->privilege) {
81
-            if($this->privilege->can_read) return true;
82
-            else return false;
83
-        }else{
87
+            if($this->privilege->can_read) {
88
+                return true;
89
+            } else {
90
+                return false;
91
+            }
92
+        } else{
84 93
             return true;
85 94
         }
86 95
     }
87 96
 
88 97
     public function canUpdate() {
89 98
         if($this->privilege) {
90
-            if($this->privilege->can_update) return true;
91
-            else return false;
92
-        }else{
99
+            if($this->privilege->can_update) {
100
+                return true;
101
+            } else {
102
+                return false;
103
+            }
104
+        } else{
93 105
             return true;
94 106
         }
95 107
     }
96 108
 
97 109
     public function canDelete() {
98 110
         if($this->privilege) {
99
-            if($this->privilege->can_delete) return true;
100
-            else return false;
101
-        }else{
111
+            if($this->privilege->can_delete) {
112
+                return true;
113
+            } else {
114
+                return false;
115
+            }
116
+        } else{
102 117
             return true;
103 118
         }
104 119
     }
@@ -107,7 +122,7 @@  discard block
 block discarded – undo
107 122
     {
108 123
         if(method_exists($this->controller_class, 'getAdd')) {
109 124
             return action($this->controller.'@getAdd');
110
-        }else{
125
+        } else{
111 126
             return null;
112 127
         }
113 128
     }
@@ -116,7 +131,7 @@  discard block
 block discarded – undo
116 131
     {
117 132
         if(method_exists($this->controller_class, 'postAddSave')) {
118 133
             return action($this->controller.'@postAddSave');
119
-        }else{
134
+        } else{
120 135
             return null;
121 136
         }
122 137
     }
@@ -125,7 +140,7 @@  discard block
 block discarded – undo
125 140
     {
126 141
         if(method_exists($this->controller_class, 'getEdit')) {
127 142
             return action($this->controller.'@getEdit',['id'=>$id]);
128
-        }else{
143
+        } else{
129 144
             return null;
130 145
         }
131 146
     }
@@ -134,7 +149,7 @@  discard block
 block discarded – undo
134 149
     {
135 150
         if(method_exists($this->controller_class, 'postEditSave')) {
136 151
             return action($this->controller.'@postEditSave',['id'=>$id]);
137
-        }else{
152
+        } else{
138 153
             return null;
139 154
         }
140 155
     }
@@ -143,7 +158,7 @@  discard block
 block discarded – undo
143 158
     {
144 159
         if(method_exists($this->controller_class, 'getDetail')) {
145 160
             return action($this->controller.'@getDetail',['id'=>$id]);
146
-        }else{
161
+        } else{
147 162
             return null;
148 163
         }
149 164
     }
@@ -152,7 +167,7 @@  discard block
 block discarded – undo
152 167
     {
153 168
         if(method_exists($this->controller_class, 'getDelete')) {
154 169
             return action($this->controller.'@getDelete',['id'=>$id]);
155
-        }else{
170
+        } else{
156 171
             return null;
157 172
         }
158 173
     }
@@ -161,7 +176,7 @@  discard block
 block discarded – undo
161 176
     {
162 177
         if(method_exists($this->controller_class, 'getIndex')) {
163 178
             return trim(action($this->controller.'@getIndex').'/'.$path,'/');
164
-        }else{
179
+        } else{
165 180
             return null;
166 181
         }
167 182
     }
Please login to merge, or discard this patch.
src/helpers/UserSession.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,11 @@
 block discarded – undo
28 28
     {
29 29
         $user = $this->user();
30 30
         $role = cb()->find("cb_roles", $user->roles_id);
31
-        if($role) return $role->name;
32
-        else return null;
31
+        if($role) {
32
+            return $role->name;
33
+        } else {
34
+            return null;
35
+        }
33 36
     }
34 37
 
35 38
     public function roleId()
Please login to merge, or discard this patch.
src/helpers/Helper.php 1 patch
Braces   +18 added lines, -15 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	    $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename;
132 132
 	    if(Storage::exists($newLocation)) {
133 133
 	        return asset($newLocation);
134
-	    }else{
134
+	    } else{
135 135
 	        $img = Image::make(storage_path($path))->fit($width,$height);
136 136
 	        $img->save(storage_path($newLocation),$quality);
137 137
 	        return asset($newLocation);
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         if(file_exists(storage_path('.cbconfig'))) {
178 178
             $settings = file_get_contents(storage_path('.cbconfig'));
179 179
             $settings = unserialize($settings);
180
-        }else{
180
+        } else{
181 181
             $settings = [];
182 182
         }
183 183
 
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
         if(file_exists(storage_path('.cbconfig'))) {
195 195
             $settings = file_get_contents(storage_path('.cbconfig'));
196 196
             $settings = unserialize($settings);
197
-        }else{
197
+        } else{
198 198
             $settings = [];
199 199
         }
200 200
 
201 201
         if(isset($settings[$key])) {
202 202
             return $settings[$key]?:$default;
203
-        }else{
203
+        } else{
204 204
             return $default;
205 205
         }
206 206
     }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         $url = request($name);
287 287
         if(filter_var($url, FILTER_VALIDATE_URL)) {
288 288
             return $url;
289
-        }else{
289
+        } else{
290 290
             return request()->url();
291 291
         }
292 292
     }
@@ -298,14 +298,14 @@  discard block
 block discarded – undo
298 298
             $response = request($name);
299 299
             if(is_string($response)) {
300 300
                 $response = sanitizeXSS($response);
301
-            }elseif (is_array($response)) {
301
+            } elseif (is_array($response)) {
302 302
                 array_walk_recursive($response, function(&$response) {
303 303
                     $response = sanitizeXSS($response);
304 304
                 });
305 305
             }
306 306
 
307 307
             return $response;
308
-        }else{
308
+        } else{
309 309
             return Request::get($name);
310 310
         }
311 311
     }
@@ -315,11 +315,13 @@  discard block
 block discarded – undo
315 315
     function min_var_export($input) {
316 316
         if(is_array($input)) {
317 317
             $buffer = [];
318
-            foreach($input as $key => $value)
319
-                $buffer[] = var_export($key, true)."=>".min_var_export($value);
318
+            foreach($input as $key => $value) {
319
+                            $buffer[] = var_export($key, true)."=>".min_var_export($value);
320
+            }
320 321
             return "[".implode(",",$buffer)."]";
321
-        } else
322
-            return var_export($input, true);
322
+        } else {
323
+                    return var_export($input, true);
324
+        }
323 325
     }
324 326
 }
325 327
 
@@ -332,10 +334,11 @@  discard block
 block discarded – undo
332 334
 	     $objects = scandir($dir); 
333 335
 	     foreach ($objects as $object) { 
334 336
 	       if ($object != "." && $object != "..") { 
335
-	         if (is_dir($dir."/".$object))
336
-	           rrmdir($dir."/".$object);
337
-	         else
338
-	           unlink($dir."/".$object); 
337
+	         if (is_dir($dir."/".$object)) {
338
+	         	           rrmdir($dir."/".$object);
339
+	         } else {
340
+	         	           unlink($dir."/".$object);
341
+	         }
339 342
 	       } 
340 343
 	     }
341 344
 	     rmdir($dir); 
Please login to merge, or discard this patch.