Passed
Push — master ( 38a665...decd12 )
by Ferry
05:33
created
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/helpers/Helper.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -118,49 +118,49 @@  discard block
 block discarded – undo
118 118
 }
119 119
 
120 120
 if(!function_exists('assetThumbnail')) {
121
-	function assetThumbnail($path) {
122
-		$path = str_replace('uploads/','uploads_thumbnail/',$path);
123
-		return asset($path);
124
-	}
121
+    function assetThumbnail($path) {
122
+        $path = str_replace('uploads/','uploads_thumbnail/',$path);
123
+        return asset($path);
124
+    }
125 125
 }
126 126
 
127 127
 if(!function_exists('assetResize')) {
128
-	function assetResize($path,$width,$height=null,$quality=70) {
129
-		$basename = basename($path);
130
-	    $pathWithoutName = str_replace($basename, '', $path);
131
-	    $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename;
132
-	    if(Storage::exists($newLocation)) {
133
-	        return asset($newLocation);
134
-	    }else{
135
-	        $img = Image::make(storage_path($path))->fit($width,$height);
136
-	        $img->save(storage_path($newLocation),$quality);
137
-	        return asset($newLocation);
138
-	    }
139
-	}
128
+    function assetResize($path,$width,$height=null,$quality=70) {
129
+        $basename = basename($path);
130
+        $pathWithoutName = str_replace($basename, '', $path);
131
+        $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename;
132
+        if(Storage::exists($newLocation)) {
133
+            return asset($newLocation);
134
+        }else{
135
+            $img = Image::make(storage_path($path))->fit($width,$height);
136
+            $img->save(storage_path($newLocation),$quality);
137
+            return asset($newLocation);
138
+        }
139
+    }
140 140
 }
141 141
 
142 142
 if(!function_exists('extract_unit')) {	
143
-	/*
143
+    /*
144 144
 	Credits: Bit Repository
145 145
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
146 146
 	*/
147
-	function extract_unit($string, $start, $end)
148
-	{
149
-	$pos = stripos($string, $start);
150
-	$str = substr($string, $pos);
151
-	$str_two = substr($str, strlen($start));
152
-	$second_pos = stripos($str_two, $end);
153
-	$str_three = substr($str_two, 0, $second_pos);
154
-	$unit = trim($str_three); // remove whitespaces
155
-	return $unit;
156
-	}
147
+    function extract_unit($string, $start, $end)
148
+    {
149
+    $pos = stripos($string, $start);
150
+    $str = substr($string, $pos);
151
+    $str_two = substr($str, strlen($start));
152
+    $second_pos = stripos($str_two, $end);
153
+    $str_three = substr($str_two, 0, $second_pos);
154
+    $unit = trim($str_three); // remove whitespaces
155
+    return $unit;
156
+    }
157 157
 }
158 158
 
159 159
 
160 160
 if(!function_exists('now')) {
161
-	function now() {		
162
-		return date('Y-m-d H:i:s');
163
-	}
161
+    function now() {		
162
+        return date('Y-m-d H:i:s');
163
+    }
164 164
 }
165 165
 
166 166
 /* 
@@ -324,22 +324,22 @@  discard block
 block discarded – undo
324 324
 }
325 325
 
326 326
 if(!function_exists('rrmdir')) {
327
-	/*
327
+    /*
328 328
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
329 329
 	*/
330
-	function rrmdir($dir) { 
331
-	   if (is_dir($dir)) { 
332
-	     $objects = scandir($dir); 
333
-	     foreach ($objects as $object) { 
334
-	       if ($object != "." && $object != "..") { 
335
-	         if (is_dir($dir."/".$object))
336
-	           rrmdir($dir."/".$object);
337
-	         else
338
-	           unlink($dir."/".$object); 
339
-	       } 
340
-	     }
341
-	     rmdir($dir); 
342
-	   } 
343
-	 }
330
+    function rrmdir($dir) { 
331
+        if (is_dir($dir)) { 
332
+            $objects = scandir($dir); 
333
+            foreach ($objects as $object) { 
334
+            if ($object != "." && $object != "..") { 
335
+                if (is_dir($dir."/".$object))
336
+                rrmdir($dir."/".$object);
337
+                else
338
+                unlink($dir."/".$object); 
339
+            } 
340
+            }
341
+            rmdir($dir); 
342
+        } 
343
+        }
344 344
 }
345 345
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -15 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	    $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename;
177 177
 	    if(Storage::exists($newLocation)) {
178 178
 	        return asset($newLocation);
179
-	    }else{
179
+	    } else{
180 180
 	        $img = Image::make(storage_path($path))->fit($width,$height);
181 181
 	        $img->save(storage_path($newLocation),$quality);
182 182
 	        return asset($newLocation);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             $settings = file_get_contents(storage_path('.cbconfig'));
224 224
             $settings = decrypt($settings);
225 225
             $settings = unserialize($settings);
226
-        }else{
226
+        } else{
227 227
             $settings = [];
228 228
         }
229 229
 
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
             $settings = file_get_contents(storage_path('.cbconfig'));
243 243
             $settings = decrypt($settings);
244 244
             $settings = unserialize($settings);
245
-        }else{
245
+        } else{
246 246
             $settings = [];
247 247
         }
248 248
 
249 249
         if(isset($settings[$key])) {
250 250
             return $settings[$key]?:$default;
251
-        }else{
251
+        } else{
252 252
             return $default;
253 253
         }
254 254
     }
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         $url = request($name);
335 335
         if(filter_var($url, FILTER_VALIDATE_URL)) {
336 336
             return $url;
337
-        }else{
337
+        } else{
338 338
             return request()->url();
339 339
         }
340 340
     }
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
             $response = request($name);
347 347
             if(is_string($response)) {
348 348
                 $response = sanitizeXSS($response);
349
-            }elseif (is_array($response)) {
349
+            } elseif (is_array($response)) {
350 350
                 array_walk_recursive($response, function(&$response) {
351 351
                     $response = sanitizeXSS($response);
352 352
                 });
353 353
             }
354 354
 
355 355
             return $response;
356
-        }else{
356
+        } else{
357 357
             return Request::get($name);
358 358
         }
359 359
     }
@@ -363,11 +363,13 @@  discard block
 block discarded – undo
363 363
     function min_var_export($input) {
364 364
         if(is_array($input)) {
365 365
             $buffer = [];
366
-            foreach($input as $key => $value)
367
-                $buffer[] = var_export($key, true)."=>".min_var_export($value);
366
+            foreach($input as $key => $value) {
367
+                            $buffer[] = var_export($key, true)."=>".min_var_export($value);
368
+            }
368 369
             return "[".implode(",",$buffer)."]";
369
-        } else
370
-            return var_export($input, true);
370
+        } else {
371
+                    return var_export($input, true);
372
+        }
371 373
     }
372 374
 }
373 375
 
@@ -380,10 +382,11 @@  discard block
 block discarded – undo
380 382
 	     $objects = scandir($dir); 
381 383
 	     foreach ($objects as $object) { 
382 384
 	       if ($object != "." && $object != "..") { 
383
-	         if (is_dir($dir."/".$object))
384
-	           rrmdir($dir."/".$object);
385
-	         else
386
-	           unlink($dir."/".$object); 
385
+	         if (is_dir($dir."/".$object)) {
386
+	         	           rrmdir($dir."/".$object);
387
+	         } else {
388
+	         	           unlink($dir."/".$object);
389
+	         }
387 390
 	       } 
388 391
 	     }
389 392
 	     rmdir($dir); 
Please login to merge, or discard this patch.
src/hooks/CBHook.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 interface CBHook {
5 5
 
6 6
     public function hookGetLogin();
7
-	public function hookPostLogin();
8
-	public function beforeBackendMiddleware($request);
7
+    public function hookPostLogin();
8
+    public function beforeBackendMiddleware($request);
9 9
     public function afterBackendMiddleware($request, $response);
10 10
 }
11 11
\ No newline at end of file
Please login to merge, or discard this patch.
src/routes.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
     if (Request::is(cbConfig('ADMIN_PATH'))) {
52 52
         if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) {
53 53
             cb()->routeGet("/", $dashboard);
54
-        }else{
54
+        } else{
55 55
             cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex");
56 56
         }
57 57
     }
Please login to merge, or discard this patch.
src/controllers/DeveloperUsersController.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,9 @@
 block discarded – undo
71 71
             $user = [];
72 72
             $user['name'] = request('name');
73 73
             $user['email'] = request('email');
74
-            if(request('password')) $user['password'] = Hash::make(request('password'));
74
+            if(request('password')) {
75
+                $user['password'] = Hash::make(request('password'));
76
+            }
75 77
             $user['cb_roles_id'] = request('cb_roles_id');
76 78
             DB::table('users')->where('id',$id)->update($user);
77 79
 
Please login to merge, or discard this patch.
src/controllers/DeveloperMenusController.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
             $menu['type'] = request('type');
55 55
             if(request('type') == 'module') {
56 56
                 $menu['cb_modules_id'] = request('cb_modules_id');
57
-            }elseif (request('type') == 'url') {
57
+            } elseif (request('type') == 'url') {
58 58
                 $menu['path'] = request('url_value');
59
-            }elseif (request('type') == 'path') {
59
+            } elseif (request('type') == 'path') {
60 60
                 $menu['path'] = request('path_value');
61 61
             }
62 62
 
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
             $menu['type'] = request('type');
80 80
             if(request('type') == 'module') {
81 81
                 $menu['cb_modules_id'] = request('cb_modules_id');
82
-            }elseif (request('type') == 'url') {
82
+            } elseif (request('type') == 'url') {
83 83
                 $menu['path'] = request('url_value');
84
-            }elseif (request('type') == 'path') {
84
+            } elseif (request('type') == 'path') {
85 85
                 $menu['path'] = request('path_value');
86 86
             }
87 87
             DB::table("cb_menus")->where("id",$id)->update($menu);
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
@@ -76,45 +76,60 @@  discard block
 block discarded – undo
76 76
 
77 77
     public function canBrowse() {
78 78
         if($this->privilege) {
79
-            if($this->privilege->can_browse) return true;
80
-            else return false;
81
-        }else{
79
+            if($this->privilege->can_browse) {
80
+                return true;
81
+            } else {
82
+                return false;
83
+            }
84
+        } else{
82 85
             return true;
83 86
         }
84 87
     }
85 88
 
86 89
     public function canCreate() {
87 90
         if($this->privilege) {
88
-            if($this->privilege->can_create) return true;
89
-            else return false;
90
-        }else{
91
+            if($this->privilege->can_create) {
92
+                return true;
93
+            } else {
94
+                return false;
95
+            }
96
+        } else{
91 97
             return true;
92 98
         }
93 99
     }
94 100
 
95 101
     public function canRead() {
96 102
         if($this->privilege) {
97
-            if($this->privilege->can_read) return true;
98
-            else return false;
99
-        }else{
103
+            if($this->privilege->can_read) {
104
+                return true;
105
+            } else {
106
+                return false;
107
+            }
108
+        } else{
100 109
             return true;
101 110
         }
102 111
     }
103 112
 
104 113
     public function canUpdate() {
105 114
         if($this->privilege) {
106
-            if($this->privilege->can_update) return true;
107
-            else return false;
108
-        }else{
115
+            if($this->privilege->can_update) {
116
+                return true;
117
+            } else {
118
+                return false;
119
+            }
120
+        } else{
109 121
             return true;
110 122
         }
111 123
     }
112 124
 
113 125
     public function canDelete() {
114 126
         if($this->privilege) {
115
-            if($this->privilege->can_delete) return true;
116
-            else return false;
117
-        }else{
127
+            if($this->privilege->can_delete) {
128
+                return true;
129
+            } else {
130
+                return false;
131
+            }
132
+        } else{
118 133
             return true;
119 134
         }
120 135
     }
@@ -123,7 +138,7 @@  discard block
 block discarded – undo
123 138
     {
124 139
         if($this->controller_class && method_exists($this->controller_class, 'getAdd')) {
125 140
             return action($this->controller.'@getAdd');
126
-        }else{
141
+        } else{
127 142
             return null;
128 143
         }
129 144
     }
@@ -132,7 +147,7 @@  discard block
 block discarded – undo
132 147
     {
133 148
         if($this->controller_class && method_exists($this->controller_class, 'postAddSave')) {
134 149
             return action($this->controller.'@postAddSave');
135
-        }else{
150
+        } else{
136 151
             return null;
137 152
         }
138 153
     }
@@ -141,7 +156,7 @@  discard block
 block discarded – undo
141 156
     {
142 157
         if($this->controller_class && method_exists($this->controller_class, 'getEdit')) {
143 158
             return action($this->controller.'@getEdit',['id'=>$id]);
144
-        }else{
159
+        } else{
145 160
             return null;
146 161
         }
147 162
     }
@@ -150,7 +165,7 @@  discard block
 block discarded – undo
150 165
     {
151 166
         if(method_exists($this->controller_class, 'postEditSave')) {
152 167
             return action($this->controller.'@postEditSave',['id'=>$id]);
153
-        }else{
168
+        } else{
154 169
             return null;
155 170
         }
156 171
     }
@@ -159,7 +174,7 @@  discard block
 block discarded – undo
159 174
     {
160 175
         if($this->controller_class && method_exists($this->controller_class, 'getDetail')) {
161 176
             return action($this->controller.'@getDetail',['id'=>$id]);
162
-        }else{
177
+        } else{
163 178
             return null;
164 179
         }
165 180
     }
@@ -168,7 +183,7 @@  discard block
 block discarded – undo
168 183
     {
169 184
         if($this->controller_class && method_exists($this->controller_class, 'getDelete')) {
170 185
             return action($this->controller.'@getDelete',['id'=>$id]);
171
-        }else{
186
+        } else{
172 187
             return null;
173 188
         }
174 189
     }
@@ -177,7 +192,7 @@  discard block
 block discarded – undo
177 192
     {
178 193
         if($this->controller_class && method_exists($this->controller_class, 'getIndex')) {
179 194
             return trim(action($this->controller.'@getIndex').'/'.$path,'/');
180
-        }else{
195
+        } else{
181 196
             return null;
182 197
         }
183 198
     }
Please login to merge, or discard this patch.
src/types/datetime/Hook.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     {
23 23
         if($column->getFormat()) {
24 24
             return date($column->getFormat(), strtotime($row->{$column->getField()}));
25
-        }else{
25
+        } else{
26 26
             return $row->{$column->getField()};
27 27
         }
28 28
     }
Please login to merge, or discard this patch.
src/types/radio/Radio.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
         $data = DB::table($table);
37 37
         if($SQLCondition && is_callable($SQLCondition)) {
38 38
             $data = call_user_func($SQLCondition, $data);
39
-        }elseif ($SQLCondition && is_string($SQLCondition)) {
39
+        } elseif ($SQLCondition && is_string($SQLCondition)) {
40 40
             $data->whereRaw($SQLCondition);
41 41
         }
42 42
         $data = $data->get();
Please login to merge, or discard this patch.