Passed
Push — master ( ab23d3...456c2a )
by Ferry
05:06
created
src/helpers/Helper.php 3 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -220,20 +220,20 @@  discard block
 block discarded – undo
220 220
 }
221 221
 
222 222
 if(!function_exists('extract_unit')) {	
223
-	/*
223
+    /*
224 224
 	Credits: Bit Repository
225 225
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
226 226
 	*/
227
-	function extract_unit($string, $start, $end)
228
-	{
229
-	$pos = stripos($string, $start);
230
-	$str = substr($string, $pos);
231
-	$str_two = substr($str, strlen($start));
232
-	$second_pos = stripos($str_two, $end);
233
-	$str_three = substr($str_two, 0, $second_pos);
234
-	$unit = trim($str_three); // remove whitespaces
235
-	return $unit;
236
-	}
227
+    function extract_unit($string, $start, $end)
228
+    {
229
+    $pos = stripos($string, $start);
230
+    $str = substr($string, $pos);
231
+    $str_two = substr($str, strlen($start));
232
+    $second_pos = stripos($str_two, $end);
233
+    $str_three = substr($str_two, 0, $second_pos);
234
+    $unit = trim($str_three); // remove whitespaces
235
+    return $unit;
236
+    }
237 237
 }
238 238
 
239 239
 /* 
@@ -407,22 +407,22 @@  discard block
 block discarded – undo
407 407
 }
408 408
 
409 409
 if(!function_exists('rrmdir')) {
410
-	/*
410
+    /*
411 411
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
412 412
 	*/
413
-	function rrmdir($dir) { 
414
-	   if (is_dir($dir)) { 
415
-	     $objects = scandir($dir); 
416
-	     foreach ($objects as $object) { 
417
-	       if ($object != "." && $object != "..") { 
418
-	         if (is_dir($dir."/".$object))
419
-	           rrmdir($dir."/".$object);
420
-	         else
421
-	           unlink($dir."/".$object); 
422
-	       } 
423
-	     }
424
-	     rmdir($dir); 
425
-	   } 
426
-	 }
413
+    function rrmdir($dir) { 
414
+        if (is_dir($dir)) { 
415
+            $objects = scandir($dir); 
416
+            foreach ($objects as $object) { 
417
+            if ($object != "." && $object != "..") { 
418
+                if (is_dir($dir."/".$object))
419
+                rrmdir($dir."/".$object);
420
+                else
421
+                unlink($dir."/".$object); 
422
+            } 
423
+            }
424
+            rmdir($dir); 
425
+        } 
426
+        }
427 427
 }
428 428
 
Please login to merge, or discard this patch.
Braces   +20 added lines, -15 removed lines patch added patch discarded remove patch
@@ -48,7 +48,9 @@  discard block
 block discarded – undo
48 48
         }
49 49
 
50 50
         $str = substr($str, 0, -1);
51
-        if (!file_put_contents($envFile, $str)) return false;
51
+        if (!file_put_contents($envFile, $str)) {
52
+            return false;
53
+        }
52 54
         return true;
53 55
     }
54 56
 }
@@ -251,7 +253,7 @@  discard block
 block discarded – undo
251 253
             $settings = file_get_contents(storage_path('.cbconfig'));
252 254
             $settings = decrypt($settings);
253 255
             $settings = unserialize($settings);
254
-        }else{
256
+        } else{
255 257
             $settings = [];
256 258
         }
257 259
 
@@ -276,14 +278,14 @@  discard block
 block discarded – undo
276 278
             $settings = file_get_contents(storage_path('.cbconfig'));
277 279
             $settings = decrypt($settings);
278 280
             $settings = unserialize($settings);
279
-        }else{
281
+        } else{
280 282
             $settings = [];
281 283
         }
282 284
 
283 285
         if(isset($settings[$key])) {
284 286
             \Illuminate\Support\Facades\Cache::forever("setting_".$key, $settings[$key]);
285 287
             return $settings[$key]?:$default;
286
-        }else{
288
+        } else{
287 289
             return $default;
288 290
         }
289 291
     }
@@ -369,7 +371,7 @@  discard block
 block discarded – undo
369 371
         $url = request($name);
370 372
         if(filter_var($url, FILTER_VALIDATE_URL)) {
371 373
             return $url;
372
-        }else{
374
+        } else{
373 375
             return request()->url();
374 376
         }
375 377
     }
@@ -381,14 +383,14 @@  discard block
 block discarded – undo
381 383
             $response = request($name);
382 384
             if(is_string($response)) {
383 385
                 $response = sanitizeXSS($response);
384
-            }elseif (is_array($response)) {
386
+            } elseif (is_array($response)) {
385 387
                 array_walk_recursive($response, function(&$response) {
386 388
                     $response = sanitizeXSS($response);
387 389
                 });
388 390
             }
389 391
 
390 392
             return $response;
391
-        }else{
393
+        } else{
392 394
             return Request::get($name);
393 395
         }
394 396
     }
@@ -398,11 +400,13 @@  discard block
 block discarded – undo
398 400
     function min_var_export($input) {
399 401
         if(is_array($input)) {
400 402
             $buffer = [];
401
-            foreach($input as $key => $value)
402
-                $buffer[] = var_export($key, true)."=>".min_var_export($value);
403
+            foreach($input as $key => $value) {
404
+                            $buffer[] = var_export($key, true)."=>".min_var_export($value);
405
+            }
403 406
             return "[".implode(",",$buffer)."]";
404
-        } else
405
-            return var_export($input, true);
407
+        } else {
408
+                    return var_export($input, true);
409
+        }
406 410
     }
407 411
 }
408 412
 
@@ -415,10 +419,11 @@  discard block
 block discarded – undo
415 419
 	     $objects = scandir($dir); 
416 420
 	     foreach ($objects as $object) { 
417 421
 	       if ($object != "." && $object != "..") { 
418
-	         if (is_dir($dir."/".$object))
419
-	           rrmdir($dir."/".$object);
420
-	         else
421
-	           unlink($dir."/".$object); 
422
+	         if (is_dir($dir."/".$object)) {
423
+	         	           rrmdir($dir."/".$object);
424
+	         } else {
425
+	         	           unlink($dir."/".$object);
426
+	         }
422 427
 	       } 
423 428
 	     }
424 429
 	     rmdir($dir); 
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!function_exists("miscellanousSingleton")) {
3
+if (!function_exists("miscellanousSingleton")) {
4 4
     /**
5 5
      * @return \crocodicstudio\crudbooster\helpers\MiscellanousSingleton
6 6
      */
@@ -9,14 +9,14 @@  discard block
 block discarded – undo
9 9
     }
10 10
 }
11 11
 
12
-if(!function_exists("makeReferalUrl")) {
12
+if (!function_exists("makeReferalUrl")) {
13 13
     function makeReferalUrl($name = null) {
14 14
         $ref = [];
15 15
         $ref['url'] = request()->fullUrl();
16 16
         $ref['name'] = $name;
17 17
         $md5Hash = md5(serialize($ref));
18 18
 
19
-        if($exist = \Illuminate\Support\Facades\Cache::get("refurl_".$md5Hash)) {
19
+        if ($exist = \Illuminate\Support\Facades\Cache::get("refurl_".$md5Hash)) {
20 20
             return $exist['id'];
21 21
         }
22 22
 
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
     }
29 29
 }
30 30
 
31
-if(!function_exists("getReferalUrl")) {
31
+if (!function_exists("getReferalUrl")) {
32 32
     function getReferalUrl($key = null) {
33
-        if(verifyReferalUrl()) {
33
+        if (verifyReferalUrl()) {
34 34
             $md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"));
35 35
             $ref = \Illuminate\Support\Facades\Cache::get("refurl_".$md5hash);
36
-            if($key) {
36
+            if ($key) {
37 37
                 return @$ref[$key];
38 38
             } else {
39 39
                 return $ref;
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
     }
44 44
 }
45 45
 
46
-if(!function_exists("verifyReferalUrl")) {
46
+if (!function_exists("verifyReferalUrl")) {
47 47
     function verifyReferalUrl()
48 48
     {
49
-        if(request("ref")) {
50
-            if($md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"))) {
49
+        if (request("ref")) {
50
+            if ($md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"))) {
51 51
                 $ref = \Illuminate\Support\Facades\Cache::get("refurl_".$md5hash);
52
-                if(filter_var($ref['url'], FILTER_VALIDATE_URL)) {
52
+                if (filter_var($ref['url'], FILTER_VALIDATE_URL)) {
53 53
                     return true;
54 54
                 }
55 55
             }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     }
59 59
 }
60 60
 
61
-if(!function_exists("putHtaccess")) {
61
+if (!function_exists("putHtaccess")) {
62 62
     function putHtaccess($stringToPut)
63 63
     {
64 64
         file_put_contents(base_path(".htaccess"), "\n".$stringToPut, FILE_APPEND);
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
     }
67 67
 }
68 68
 
69
-if(!function_exists("checkHtaccess")) {
69
+if (!function_exists("checkHtaccess")) {
70 70
     function checkHtaccess($stringToCheck)
71 71
     {
72
-        if(file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) {
72
+        if (file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) {
73 73
             $htaccess = file_get_contents(base_path(".htaccess"));
74
-            $htaccess2= file_get_contents(public_path(".htaccess"));
75
-            if(\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) {
74
+            $htaccess2 = file_get_contents(public_path(".htaccess"));
75
+            if (\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) {
76 76
                 return true;
77 77
             }
78 78
         }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     }
82 82
 }
83 83
 
84
-if(!function_exists("setEnvironmentValue")) {
84
+if (!function_exists("setEnvironmentValue")) {
85 85
     function setEnvironmentValue(array $values)
86 86
     {
87 87
         $envFile = app()->environmentFilePath();
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 }
113 113
 
114 114
 
115
-if(!function_exists("cbLang")) {
115
+if (!function_exists("cbLang")) {
116 116
     /**
117 117
      * @param string $key
118 118
      * @param array $replace
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
     }
125 125
 }
126 126
 
127
-if(!function_exists('rglob')) {
127
+if (!function_exists('rglob')) {
128 128
     function rglob($pattern, $flags = 0) {
129 129
         $files = glob($pattern, $flags);
130
-        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
130
+        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
131 131
             $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags));
132 132
         }
133 133
         return $files;
134 134
     }
135 135
 }
136 136
 
137
-if(!function_exists('convertPHPToMomentFormat')) {
137
+if (!function_exists('convertPHPToMomentFormat')) {
138 138
     function convertPHPToMomentFormat($format)
139 139
     {
140 140
         $replacements = [
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
     }
182 182
 }
183 183
 
184
-if(!function_exists('slug')) {
184
+if (!function_exists('slug')) {
185 185
     function slug($string, $separator = '-') {
186 186
         return \Illuminate\Support\Str::slug($string, $separator);
187 187
     }
188 188
 }
189 189
 
190
-if(!function_exists('columnSingleton')) {
190
+if (!function_exists('columnSingleton')) {
191 191
     /**
192 192
      * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton
193 193
      */
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     }
197 197
 }
198 198
 
199
-if(!function_exists('cbHook'))
199
+if (!function_exists('cbHook'))
200 200
 {
201 201
     /**
202 202
      * @return crocodicstudio\crudbooster\hooks\CBHook
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     }
209 209
 }
210 210
 
211
-if(!function_exists('getTypeHook'))
211
+if (!function_exists('getTypeHook'))
212 212
 {
213 213
     /**
214 214
      * @param string $type
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     }
222 222
 }
223 223
 
224
-if(!function_exists('getPrimaryKey'))
224
+if (!function_exists('getPrimaryKey'))
225 225
 {
226 226
     function getPrimaryKey($table_name)
227 227
     {
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     }
230 230
 }
231 231
 
232
-if(!function_exists('cb'))
232
+if (!function_exists('cb'))
233 233
 {
234 234
     function cb()
235 235
     {
@@ -237,25 +237,25 @@  discard block
 block discarded – undo
237 237
     }
238 238
 }
239 239
 
240
-if(!function_exists('cbAsset')) {
240
+if (!function_exists('cbAsset')) {
241 241
     function cbAsset($path, $secure = null) {
242 242
         return asset("cb_asset/".$path, $secure);
243 243
     }
244 244
 }
245 245
 
246
-if(!function_exists("cbConfig")) {
246
+if (!function_exists("cbConfig")) {
247 247
     function cbConfig($name, $default = null) {
248 248
         return config("crudbooster.".$name, $default);
249 249
     }
250 250
 }
251 251
 
252
-if(!function_exists("strRandom")) {
252
+if (!function_exists("strRandom")) {
253 253
     function strRandom($length = 5) {
254 254
         return \Illuminate\Support\Str::random($length);
255 255
     }
256 256
 }
257 257
 
258
-if(!function_exists('module')) {
258
+if (!function_exists('module')) {
259 259
     function module()
260 260
     {
261 261
         $module = new \crocodicstudio\crudbooster\helpers\Module();
@@ -263,21 +263,21 @@  discard block
 block discarded – undo
263 263
     }
264 264
 }
265 265
 
266
-if(!function_exists('getAdminLoginURL')) {
266
+if (!function_exists('getAdminLoginURL')) {
267 267
     function getAdminLoginURL()
268 268
     {
269 269
         return cb()->getAdminUrl("login");
270 270
     }
271 271
 }
272 272
 
273
-if(!function_exists('dummyPhoto')) {
273
+if (!function_exists('dummyPhoto')) {
274 274
     function dummyPhoto()
275 275
     {
276 276
         return cbConfig("DUMMY_PHOTO");
277 277
     }
278 278
 }
279 279
 
280
-if(!function_exists('extract_unit')) {	
280
+if (!function_exists('extract_unit')) {	
281 281
 	/*
282 282
 	Credits: Bit Repository
283 283
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
@@ -302,14 +302,14 @@  discard block
 block discarded – undo
302 302
 |
303 303
 */
304 304
 
305
-if(!function_exists('putSetting')) {
305
+if (!function_exists('putSetting')) {
306 306
     function putSetting($key, $value)
307 307
     {
308
-        if(file_exists(storage_path('.cbconfig'))) {
308
+        if (file_exists(storage_path('.cbconfig'))) {
309 309
             $settings = file_get_contents(storage_path('.cbconfig'));
310 310
             $settings = decrypt($settings);
311 311
             $settings = unserialize($settings);
312
-        }else{
312
+        } else {
313 313
             $settings = [];
314 314
         }
315 315
 
@@ -323,31 +323,31 @@  discard block
 block discarded – undo
323 323
     }
324 324
 }
325 325
 
326
-if(!function_exists('getSetting')) {
326
+if (!function_exists('getSetting')) {
327 327
     function getSetting($key, $default = null)
328 328
     {
329
-        if($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) {
329
+        if ($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) {
330 330
             return $cache;
331 331
         }
332 332
 
333
-        if(file_exists(storage_path('.cbconfig'))) {
333
+        if (file_exists(storage_path('.cbconfig'))) {
334 334
             $settings = file_get_contents(storage_path('.cbconfig'));
335 335
             $settings = decrypt($settings);
336 336
             $settings = unserialize($settings);
337
-        }else{
337
+        } else {
338 338
             $settings = [];
339 339
         }
340 340
 
341
-        if(isset($settings[$key])) {
341
+        if (isset($settings[$key])) {
342 342
             \Illuminate\Support\Facades\Cache::forever("setting_".$key, $settings[$key]);
343
-            return $settings[$key]?:$default;
344
-        }else{
343
+            return $settings[$key] ?: $default;
344
+        } else {
345 345
             return $default;
346 346
         }
347 347
     }
348 348
 }
349 349
 
350
-if(!function_exists('timeAgo')) {
350
+if (!function_exists('timeAgo')) {
351 351
     function timeAgo($datetime_to, $datetime_from = null, $full = false)
352 352
     {
353 353
         $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
             }
379 379
         }
380 380
 
381
-        if (! $full) {
381
+        if (!$full) {
382 382
             $string = array_slice($string, 0, 1);
383 383
         }
384 384
 
@@ -386,22 +386,22 @@  discard block
 block discarded – undo
386 386
     }
387 387
 }
388 388
 
389
-if(!function_exists("array_map_r")) {
390
-    function array_map_r( $func, $arr )
389
+if (!function_exists("array_map_r")) {
390
+    function array_map_r($func, $arr)
391 391
     {
392 392
         $newArr = array();
393 393
 
394
-        foreach( $arr as $key => $value )
394
+        foreach ($arr as $key => $value)
395 395
         {
396 396
             $key = $func($key);
397
-            $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) );
397
+            $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value)));
398 398
         }
399 399
 
400 400
         return $newArr;
401 401
     }
402 402
 }
403 403
 
404
-if(!function_exists("sanitizeXSS"))
404
+if (!function_exists("sanitizeXSS"))
405 405
 {
406 406
     function sanitizeXSS($value)
407 407
     {
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
     }
414 414
 }
415 415
 
416
-if(!function_exists("requestAll")) {
416
+if (!function_exists("requestAll")) {
417 417
     function requestAll() {
418 418
         $all = array_map_r("sanitizeXSS", request()->all());
419 419
         return $all;
@@ -422,22 +422,22 @@  discard block
 block discarded – undo
422 422
 
423 423
 
424 424
 
425
-if(!function_exists('getURLFormat')) {
425
+if (!function_exists('getURLFormat')) {
426 426
     function getURLFormat($name) {
427 427
         $url = request($name);
428
-        if(filter_var($url, FILTER_VALIDATE_URL)) {
428
+        if (filter_var($url, FILTER_VALIDATE_URL)) {
429 429
             return $url;
430
-        }else{
430
+        } else {
431 431
             return request()->url();
432 432
         }
433 433
     }
434 434
 }
435 435
 
436
-if(!function_exists('g')) {
436
+if (!function_exists('g')) {
437 437
     function g($name, $safe = true) {
438
-        if($safe == true) {
438
+        if ($safe == true) {
439 439
             $response = request($name);
440
-            if(is_string($response)) {
440
+            if (is_string($response)) {
441 441
                 $response = sanitizeXSS($response);
442 442
             }elseif (is_array($response)) {
443 443
                 array_walk_recursive($response, function(&$response) {
@@ -446,25 +446,25 @@  discard block
 block discarded – undo
446 446
             }
447 447
 
448 448
             return $response;
449
-        }else{
449
+        } else {
450 450
             return Request::get($name);
451 451
         }
452 452
     }
453 453
 }
454 454
 
455
-if(!function_exists('min_var_export')) {
455
+if (!function_exists('min_var_export')) {
456 456
     function min_var_export($input) {
457
-        if(is_array($input)) {
457
+        if (is_array($input)) {
458 458
             $buffer = [];
459
-            foreach($input as $key => $value)
459
+            foreach ($input as $key => $value)
460 460
                 $buffer[] = var_export($key, true)."=>".min_var_export($value);
461
-            return "[".implode(",",$buffer)."]";
461
+            return "[".implode(",", $buffer)."]";
462 462
         } else
463 463
             return var_export($input, true);
464 464
     }
465 465
 }
466 466
 
467
-if(!function_exists('rrmdir')) {
467
+if (!function_exists('rrmdir')) {
468 468
 	/*
469 469
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
470 470
 	*/
Please login to merge, or discard this patch.
src/helpers/CurlHelper.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function headers(array $headers) {
27 27
         $newHeaders = [];
28
-        foreach($headers as $key=>$val) {
28
+        foreach ($headers as $key=>$val) {
29 29
             $newHeaders[] = $key.": ".$val;
30 30
         }
31 31
         $this->headers = $newHeaders;
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
         $err = curl_error($ch);
48 48
         curl_close($ch);
49 49
 
50
-        if($err) {
50
+        if ($err) {
51 51
             return $err;
52
-        }else {
52
+        } else {
53 53
             return $response;
54 54
         }
55 55
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 
50 50
         if($err) {
51 51
             return $err;
52
-        }else {
52
+        } else {
53 53
             return $response;
54 54
         }
55 55
     }
Please login to merge, or discard this patch.
src/commands/Install.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
         if ($this->confirm('Do you have setting the database configuration at .env ?')) {
41 41
 
42
-            if (! file_exists(public_path('vendor')) ) {
42
+            if (!file_exists(public_path('vendor'))) {
43 43
                 mkdir(public_path('vendor'));
44 44
             }
45 45
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             /*
53 53
              * Create CBPlugins
54 54
              */
55
-            if(!file_exists(app_path("CBPlugins"))) {
55
+            if (!file_exists(app_path("CBPlugins"))) {
56 56
                 mkdir(app_path("CBPlugins"));
57 57
             }
58 58
 
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
              * We need it to change default laravel local filesystem from storage to public
62 62
              * We won't use symlink because of a security issue in many server
63 63
              */
64
-            if(!file_exists(public_path("storage"))) {
64
+            if (!file_exists(public_path("storage"))) {
65 65
                 $this->info("Create storage directory on /public");
66 66
                 mkdir(public_path("storage"));
67
-                file_put_contents(public_path("storage/.gitignore"),"!.gitignore");
68
-                file_put_contents(public_path("storage/index.html"),"&nbsp;");
67
+                file_put_contents(public_path("storage/.gitignore"), "!.gitignore");
68
+                file_put_contents(public_path("storage/index.html"), "&nbsp;");
69 69
             }
70 70
 
71 71
             /*
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
              * Disable php execution on /vendor/*
75 75
              */
76 76
             $this->info("Tweak some security for your laravel");
77
-            file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND);
78
-            file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND);
77
+            file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND);
78
+            file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND);
79 79
 
80 80
 
81 81
             $this->info('Dumping the autoloaded files and reloading all new files...');
Please login to merge, or discard this patch.
src/routes.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
     if (Request::is(cb()->getAdminPath())) {
59 59
         if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) {
60 60
             cb()->routeGet("/", $dashboard);
61
-        }else{
61
+        } else{
62 62
             cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex");
63 63
         }
64 64
     }
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,58 +1,58 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Developer Backend Middleware
4
-Route::group(['middleware' => ['web',\crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
4
+Route::group(['middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
5 5
     'prefix'=>"developer/".getSetting('developer_path'),
6
-    'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
6
+    'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
7 7
     cb()->routeController("modules", "\crocodicstudio\crudbooster\controllers\DeveloperModulesController");
8 8
     cb()->routeController("menus", "\crocodicstudio\crudbooster\controllers\DeveloperMenusController");
9
-    cb()->routeController("roles","\crocodicstudio\crudbooster\controllers\DeveloperRolesController");
10
-    cb()->routeController("users","\crocodicstudio\crudbooster\controllers\DeveloperUsersController");
11
-    cb()->routeController("plugins","\crocodicstudio\crudbooster\controllers\DeveloperPluginStoreController");
12
-    cb()->routeController("mail","\crocodicstudio\crudbooster\controllers\DeveloperMailController");
13
-    cb()->routeController("security","\crocodicstudio\crudbooster\controllers\DeveloperSecurityController");
14
-    cb()->routeController("appearance","\crocodicstudio\crudbooster\controllers\DeveloperAppearanceController");
15
-    cb()->routeController("miscellaneous","\crocodicstudio\crudbooster\controllers\DeveloperMiscellaneousController");
16
-    cb()->routePost("skip-tutorial","DeveloperDashboardController@postSkipTutorial");
17
-    cb()->routeGet("/","DeveloperDashboardController@getIndex");
9
+    cb()->routeController("roles", "\crocodicstudio\crudbooster\controllers\DeveloperRolesController");
10
+    cb()->routeController("users", "\crocodicstudio\crudbooster\controllers\DeveloperUsersController");
11
+    cb()->routeController("plugins", "\crocodicstudio\crudbooster\controllers\DeveloperPluginStoreController");
12
+    cb()->routeController("mail", "\crocodicstudio\crudbooster\controllers\DeveloperMailController");
13
+    cb()->routeController("security", "\crocodicstudio\crudbooster\controllers\DeveloperSecurityController");
14
+    cb()->routeController("appearance", "\crocodicstudio\crudbooster\controllers\DeveloperAppearanceController");
15
+    cb()->routeController("miscellaneous", "\crocodicstudio\crudbooster\controllers\DeveloperMiscellaneousController");
16
+    cb()->routePost("skip-tutorial", "DeveloperDashboardController@postSkipTutorial");
17
+    cb()->routeGet("/", "DeveloperDashboardController@getIndex");
18 18
 });
19 19
 
20 20
 // Developer Auth Middleware
21 21
 Route::group(['middleware' => ['web'],
22 22
     'prefix'=>"developer/".getSetting('developer_path'),
23
-    'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
24
-    cb()->routePost("login","AdminAuthController@postLoginDeveloper");
25
-    cb()->routeGet("login","AdminAuthController@getLoginDeveloper");
26
-    cb()->routeGet("logout","AdminAuthController@getLogoutDeveloper");
23
+    'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
24
+    cb()->routePost("login", "AdminAuthController@postLoginDeveloper");
25
+    cb()->routeGet("login", "AdminAuthController@getLoginDeveloper");
26
+    cb()->routeGet("logout", "AdminAuthController@getLogoutDeveloper");
27 27
 });
28 28
 
29 29
 // Routing without any middleware
30
-Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function () {
31
-    if(getSetting("AUTO_REDIRECT_TO_LOGIN")) {
32
-        cb()->routeGet("/","AdminAuthController@getRedirectToLogin");
30
+Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function() {
31
+    if (getSetting("AUTO_REDIRECT_TO_LOGIN")) {
32
+        cb()->routeGet("/", "AdminAuthController@getRedirectToLogin");
33 33
     }
34 34
 });
35 35
 
36 36
 // Routing without any middleware with admin prefix
37
-Route::group(['middleware' => ['web'], 'prefix' => cb()->getAdminPath(), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
37
+Route::group(['middleware' => ['web'], 'prefix' => cb()->getAdminPath(), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
38 38
     cb()->routeGet('logout', "AdminAuthController@getLogout");
39 39
 
40
-    if(!getSetting("DISABLE_LOGIN")) {
40
+    if (!getSetting("DISABLE_LOGIN")) {
41 41
         cb()->routePost('login', "AdminAuthController@postLogin");
42 42
         cb()->routeGet('login', "AdminAuthController@getLogin");
43 43
     }
44 44
 
45
-    if(getSetting("enable_forget")) {
46
-        cb()->routePost("forget","AdminAuthController@postForget");
45
+    if (getSetting("enable_forget")) {
46
+        cb()->routePost("forget", "AdminAuthController@postForget");
47 47
     }
48 48
 
49
-    if(getSetting("enable_register")) {
50
-        cb()->routePost("register","AdminAuthController@postRegister");
49
+    if (getSetting("enable_register")) {
50
+        cb()->routePost("register", "AdminAuthController@postRegister");
51 51
     }
52 52
 });
53 53
 
54 54
 // Routing package controllers
55
-cb()->routeGroupBackend(function () {
55
+cb()->routeGroupBackend(function() {
56 56
     cb()->routeController('profile', '\crocodicstudio\crudbooster\controllers\AdminProfileController');
57 57
 });
58 58
 
@@ -61,24 +61,24 @@  discard block
 block discarded – undo
61 61
     'middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBBackend::class],
62 62
     'prefix' => cb()->getAdminPath(),
63 63
     'namespace' => 'App\Http\Controllers',
64
-], function () {
64
+], function() {
65 65
 
66 66
     if (Request::is(cb()->getAdminPath())) {
67
-        if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) {
67
+        if ($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) {
68 68
             cb()->routeGet("/", $dashboard);
69
-        }else{
69
+        } else {
70 70
             cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex");
71 71
         }
72 72
     }
73 73
 
74 74
     $controllers = glob(app_path('Http/Controllers/Admin*Controller.php'));
75 75
 
76
-    foreach($controllers as $controller) {
76
+    foreach ($controllers as $controller) {
77 77
         $controllerName = basename($controller);
78
-        $controllerName = rtrim($controllerName,".php");
78
+        $controllerName = rtrim($controllerName, ".php");
79 79
         $className = '\App\Http\Controllers\\'.$controllerName;
80 80
         $controllerClass = new $className();
81
-        if(method_exists($controllerClass, 'cbInit')) {
81
+        if (method_exists($controllerClass, 'cbInit')) {
82 82
             cb()->routeController($controllerClass->getData('permalink'), $controllerName);
83 83
         }
84 84
     }
Please login to merge, or discard this patch.
src/helpers/HTMLHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $data['name'] = $name;
26 26
         $data['label'] = $label;
27 27
         $data['required'] = $required;
28
-        $data['encrypt'] = isset($options['encrypt'])?$options['encrypt']:true;
28
+        $data['encrypt'] = isset($options['encrypt']) ? $options['encrypt'] : true;
29 29
         return view("crudbooster::html_helper.file_uploader.index", $data);
30 30
     }
31 31
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $data['name'] = $name;
43 43
         $data['label'] = $label;
44 44
         $data['required'] = $required;
45
-        $data['encrypt'] = isset($options['encrypt'])?$options['encrypt']:true;
45
+        $data['encrypt'] = isset($options['encrypt']) ? $options['encrypt'] : true;
46 46
         @$data['resizeWidth'] = $options['resize_width'];
47 47
         @$data['resizeHeight'] = $options['resize_height'];
48 48
         return view("crudbooster::html_helper.image_uploader.index", $data);
Please login to merge, or discard this patch.
src/types/file/Route.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-cb()->routeGroupBackend(function () {
4
-    cb()->routePost("upload-file",'\crocodicstudio\crudbooster\types\file\FileController@postUploadFile');
3
+cb()->routeGroupBackend(function() {
4
+    cb()->routePost("upload-file", '\crocodicstudio\crudbooster\types\file\FileController@postUploadFile');
5 5
 });
6 6
 
7
-cb()->routeGroupDeveloper(function () {
8
-    cb()->routePost("upload-file",'\crocodicstudio\crudbooster\types\file\FileController@postUploadFile');
7
+cb()->routeGroupDeveloper(function() {
8
+    cb()->routePost("upload-file", '\crocodicstudio\crudbooster\types\file\FileController@postUploadFile');
9 9
 });
10 10
\ No newline at end of file
Please login to merge, or discard this patch.
src/types/file/FileController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,15 +19,15 @@
 block discarded – undo
19 19
         try {
20 20
 
21 21
             cb()->validation([
22
-                'userfile' => 'required|mimes:' . implode(",",config('crudbooster.UPLOAD_FILE_EXTENSION_ALLOWED'))
22
+                'userfile' => 'required|mimes:'.implode(",", config('crudbooster.UPLOAD_FILE_EXTENSION_ALLOWED'))
23 23
             ]);
24 24
 
25 25
             $file = cb()->uploadFile('userfile', request("encrypt"));
26 26
 
27 27
         } catch (CBValidationException $e) {
28
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
28
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
29 29
         } catch (\Exception $e) {
30
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
30
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
31 31
         }
32 32
 
33 33
         return response()->json([
Please login to merge, or discard this patch.
src/types/image/ImageController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,15 +18,15 @@
 block discarded – undo
18 18
         try {
19 19
 
20 20
             cb()->validation([
21
-                'userfile' => 'required|mimes:' . implode(",",config('crudbooster.UPLOAD_IMAGE_EXTENSION_ALLOWED'))
21
+                'userfile' => 'required|mimes:'.implode(",", config('crudbooster.UPLOAD_IMAGE_EXTENSION_ALLOWED'))
22 22
             ]);
23 23
 
24
-            $file = cb()->uploadFile('userfile', request("encrypt")?true:false, request("resize_width"), request("resize_height"));
24
+            $file = cb()->uploadFile('userfile', request("encrypt") ?true:false, request("resize_width"), request("resize_height"));
25 25
 
26 26
         } catch (CBValidationException $e) {
27
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
27
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
28 28
         } catch (\Exception $e) {
29
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
29
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
30 30
         }
31 31
 
32 32
         return response()->json([
Please login to merge, or discard this patch.
src/types/image/Route.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-cb()->routeGroupBackend(function () {
4
-    cb()->routePost("upload-image",'\crocodicstudio\crudbooster\types\image\ImageController@postUploadImage');
3
+cb()->routeGroupBackend(function() {
4
+    cb()->routePost("upload-image", '\crocodicstudio\crudbooster\types\image\ImageController@postUploadImage');
5 5
 });
6 6
 
7
-cb()->routeGroupDeveloper(function () {
8
-    cb()->routePost("upload-image",'\crocodicstudio\crudbooster\types\image\ImageController@postUploadImage');
7
+cb()->routeGroupDeveloper(function() {
8
+    cb()->routePost("upload-image", '\crocodicstudio\crudbooster\types\image\ImageController@postUploadImage');
9 9
 });
Please login to merge, or discard this patch.