Passed
Push — master ( 95e7d1...09ce37 )
by Ferry
04:01
created
src/commands/DeveloperCommandService.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@
 block discarded – undo
25 25
     {
26 26
 
27 27
         try {
28
-            if(@$this->command->option("password") == "AUTO" || !@$this->command->option("password")) {
28
+            if (@$this->command->option("password") == "AUTO" || !@$this->command->option("password")) {
29 29
                 $password = Str::random(16);
30
-            }else{
30
+            } else {
31 31
                 $password = $this->command->option("password");
32 32
             }
33 33
 
34
-            if(@$this->command->option("username") == "AUTO" || !@$this->command->option("username")) {
34
+            if (@$this->command->option("username") == "AUTO" || !@$this->command->option("username")) {
35 35
                 $username = Str::random(5);
36
-            }else{
36
+            } else {
37 37
                 $username = $this->command->option("username");
38 38
             }
39 39
         } catch (\Exception $e) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@
 block discarded – undo
27 27
         try {
28 28
             if(@$this->command->option("password") == "AUTO" || !@$this->command->option("password")) {
29 29
                 $password = Str::random(16);
30
-            }else{
30
+            } else{
31 31
                 $password = $this->command->option("password");
32 32
             }
33 33
 
34 34
             if(@$this->command->option("username") == "AUTO" || !@$this->command->option("username")) {
35 35
                 $username = Str::random(5);
36
-            }else{
36
+            } else{
37 37
                 $username = $this->command->option("username");
38 38
             }
39 39
         } catch (\Exception $e) {
Please login to merge, or discard this patch.
src/helpers/Plugin.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,26 +15,26 @@  discard block
 block discarded – undo
15 15
 
16 16
     public static function has($key)
17 17
     {
18
-        if(file_exists(app_path("CBPlugins/".$key))) return true;
18
+        if (file_exists(app_path("CBPlugins/".$key))) return true;
19 19
         else return false;
20 20
     }
21 21
 
22 22
     public static function isNeedUpgrade($pluginKey, $versionToCompare)
23 23
     {
24 24
         $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$pluginKey."/plugin.json")), true);
25
-        if($pluginJson) {
26
-            return version_compare($pluginJson['version'], $versionToCompare,"!=");
27
-        }else{
25
+        if ($pluginJson) {
26
+            return version_compare($pluginJson['version'], $versionToCompare, "!=");
27
+        } else {
28 28
             return false;
29 29
         }
30 30
     }
31 31
 
32 32
     public static function registerDefaultRoute($dir)
33 33
     {
34
-        Route::group(['middleware' => ['web',\crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
34
+        Route::group(['middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
35 35
             'prefix'=>"developer/".getSetting('developer_path'),
36
-            'namespace' => 'App\CBPlugins\\'.basename(dirname("./../".$dir)).'\Controllers'], function () use ($dir) {
37
-            cb()->routeController("plugins/".basename(dirname("./../".$dir)),"\App\CBPlugins\\".basename(dirname("./../".$dir))."\Controllers\\".basename(dirname("./../".$dir))."Controller");
36
+            'namespace' => 'App\CBPlugins\\'.basename(dirname("./../".$dir)).'\Controllers'], function() use ($dir) {
37
+            cb()->routeController("plugins/".basename(dirname("./../".$dir)), "\App\CBPlugins\\".basename(dirname("./../".$dir))."\Controllers\\".basename(dirname("./../".$dir))."Controller");
38 38
         });
39 39
     }
40 40
 
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
         $plugins = scandir(app_path("CBPlugins"));
44 44
 
45 45
         $result = [];
46
-        foreach($plugins as $plugin) {
47
-            if($plugin != "." && $plugin != "..") {
46
+        foreach ($plugins as $plugin) {
47
+            if ($plugin != "." && $plugin != "..") {
48 48
                 $basename = basename($plugin);
49 49
                 $row = json_decode(file_get_contents(app_path("CBPlugins".DIRECTORY_SEPARATOR.$plugin.DIRECTORY_SEPARATOR."plugin.json")), true);
50
-                if($row) {
50
+                if ($row) {
51 51
                     $result[] = [
52 52
                         "name"=>$row['name'],
53 53
                         "version"=>$row['version'],
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,8 +15,11 @@  discard block
 block discarded – undo
15 15
 
16 16
     public static function has($key)
17 17
     {
18
-        if(file_exists(app_path("CBPlugins/".$key))) return true;
19
-        else return false;
18
+        if(file_exists(app_path("CBPlugins/".$key))) {
19
+            return true;
20
+        } else {
21
+            return false;
22
+        }
20 23
     }
21 24
 
22 25
     public static function isNeedUpgrade($pluginKey, $versionToCompare)
@@ -24,7 +27,7 @@  discard block
 block discarded – undo
24 27
         $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$pluginKey."/plugin.json")), true);
25 28
         if($pluginJson) {
26 29
             return version_compare($pluginJson['version'], $versionToCompare,"!=");
27
-        }else{
30
+        } else{
28 31
             return false;
29 32
         }
30 33
     }
Please login to merge, or discard this patch.
src/controllers/DeveloperDashboardController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     public function getIndex() {
19 19
         $data = [];
20 20
         $data['page_title'] = "Dashboard";
21
-        return view('crudbooster::dev_layouts.modules.dashboard',$data);
21
+        return view('crudbooster::dev_layouts.modules.dashboard', $data);
22 22
     }
23 23
     
24 24
     public function postSkipTutorial()
Please login to merge, or discard this patch.
src/controllers/DeveloperMailController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function getIndex() {
26 26
         $data = [];
27
-        return view($this->view.".index",$data);
27
+        return view($this->view.".index", $data);
28 28
     }
29 29
 
30 30
     public function postSave()
@@ -38,6 +38,6 @@  discard block
 block discarded – undo
38 38
             "MAIL_ENCRYPTION"=>request("MAIL_ENCRYPTION")
39 39
         ]);
40 40
 
41
-        return cb()->redirectBack("Mail configuration has been updated!","success");
41
+        return cb()->redirectBack("Mail configuration has been updated!", "success");
42 42
     }
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
src/controllers/AdminProfileController.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
     public function getIndex() {
12 12
         $data = [];
13 13
         $data['page_title'] = cbLang("profile");
14
-        return view('crudbooster::profile',$data);
14
+        return view('crudbooster::profile', $data);
15 15
     }
16 16
 
17 17
     public function postUpdate() {
18
-        validator(request()->all(),[
18
+        validator(request()->all(), [
19 19
             'name'=>'required|max:255|min:3',
20 20
             'email'=>'required|email',
21 21
             'photo'=>'image',
@@ -26,20 +26,20 @@  discard block
 block discarded – undo
26 26
             $data = [];
27 27
             $data['name'] = request('name');
28 28
             $data['email'] = request('email');
29
-            if(request('password')) {
29
+            if (request('password')) {
30 30
                 $data['password'] = Hash::make(request('password'));
31 31
             }
32
-            if(request()->hasFile('photo')) {
32
+            if (request()->hasFile('photo')) {
33 33
                 $data['photo'] = cb()->uploadFile('photo', true, 200, 200);
34 34
             }
35 35
 
36 36
             DB::table("users")->where("id", auth()->id())->update($data);
37
-        }catch (\Exception $e) {
37
+        } catch (\Exception $e) {
38 38
             Log::error($e);
39
-            return cb()->redirectBack(cbLang("something_went_wrong"),"warning");
39
+            return cb()->redirectBack(cbLang("something_went_wrong"), "warning");
40 40
         }
41 41
 
42
-        return cb()->redirectBack("The profile data has been updated!","success");
42
+        return cb()->redirectBack("The profile data has been updated!", "success");
43 43
     }
44 44
 
45 45
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
             }
35 35
 
36 36
             DB::table("users")->where("id", auth()->id())->update($data);
37
-        }catch (\Exception $e) {
37
+        } catch (\Exception $e) {
38 38
             Log::error($e);
39 39
             return cb()->redirectBack(cbLang("something_went_wrong"),"warning");
40 40
         }
Please login to merge, or discard this patch.
src/controllers/DeveloperAuthController.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,25 +19,25 @@
 block discarded – undo
19 19
     }
20 20
 
21 21
     public function postLoginDeveloper() {
22
-        try{
22
+        try {
23 23
             cb()->validation([
24 24
                 'username'=>'required',
25 25
                 'password'=>'required'
26 26
             ]);
27 27
 
28
-            if(request('username') == getSetting('developer_username')
28
+            if (request('username') == getSetting('developer_username')
29 29
                 && request('password') == getSetting("developer_password")) {
30 30
 
31 31
                 session(['developer'=>getSetting('developer_username')]);
32 32
 
33 33
                 return redirect(cb()->getDeveloperUrl());
34 34
 
35
-            }else{
36
-                return cb()->redirectBack( cbLang("password_and_username_is_wrong"));
35
+            } else {
36
+                return cb()->redirectBack(cbLang("password_and_username_is_wrong"));
37 37
             }
38 38
 
39
-        }catch (CBValidationException $e) {
40
-            return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning');
39
+        } catch (CBValidationException $e) {
40
+            return cb()->redirect(cb()->getLoginUrl(), $e->getMessage(), 'warning');
41 41
         }
42 42
     }
43 43
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@
 block discarded – undo
32 32
 
33 33
                 return redirect(cb()->getDeveloperUrl());
34 34
 
35
-            }else{
35
+            } else{
36 36
                 return cb()->redirectBack( cbLang("password_and_username_is_wrong"));
37 37
             }
38 38
 
39
-        }catch (CBValidationException $e) {
39
+        } catch (CBValidationException $e) {
40 40
             return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning');
41 41
         }
42 42
     }
Please login to merge, or discard this patch.
src/controllers/AdminAuthController.php 2 patches
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function getLogin()
35 35
     {
36
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
36
+        if(!auth()->guest()) {
37
+            return redirect(cb()->getAdminUrl());
38
+        }
37 39
 
38 40
         cbHook()->hookGetLogin();
39 41
 
@@ -43,7 +45,9 @@  discard block
 block discarded – undo
43 45
     public function postLogin()
44 46
     {
45 47
         try{
46
-            if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
48
+            if($this->isSuspendedLogin()) {
49
+                throw new CBValidationException(cbLang("you_have_been_suspended"));
50
+            }
47 51
 
48 52
             cb()->validation([
49 53
                 'email'=>'required|email',
@@ -58,7 +62,7 @@  discard block
 block discarded – undo
58 62
                 $this->incrementFailedLogin();
59 63
                 return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']);
60 64
             }
61
-        }catch (CBValidationException $e) {
65
+        } catch (CBValidationException $e) {
62 66
             return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
63 67
         }
64 68
     }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,29 +20,29 @@  discard block
 block discarded – undo
20 20
 
21 21
     public function getLogin()
22 22
     {
23
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
23
+        if (!auth()->guest()) return redirect(cb()->getAdminUrl());
24 24
 
25 25
         cbHook()->hookGetLogin();
26 26
 
27 27
         $data = [];
28
-        $data['no1'] = rand(1,10);
29
-        $data['no2'] = rand(1,10);
30
-        Session::put("captcha_result", $data['no1']+$data['no2']);
28
+        $data['no1'] = rand(1, 10);
29
+        $data['no2'] = rand(1, 10);
30
+        Session::put("captcha_result", $data['no1'] + $data['no2']);
31 31
 
32
-        return view( str_replace(".blade.php", "", getSetting('login_page_view','crudbooster::login')), $data );
32
+        return view(str_replace(".blade.php", "", getSetting('login_page_view', 'crudbooster::login')), $data);
33 33
     }
34 34
 
35 35
     public function postLogin()
36 36
     {
37
-        try{
38
-            if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
37
+        try {
38
+            if ($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
39 39
 
40 40
             cb()->validation([
41 41
                 'email'=>'required|email',
42 42
                 'password'=>'required'
43 43
             ]);
44 44
 
45
-            $credential = request()->only(['email','password']);
45
+            $credential = request()->only(['email', 'password']);
46 46
             if (auth()->attempt($credential)) {
47 47
 
48 48
                 // When login user success, clear suspend attempt
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
                 return redirect(cb()->getAdminUrl());
54 54
             } else {
55 55
                 $this->incrementFailedLogin();
56
-                return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']);
56
+                return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'), 'message_type'=>'warning']);
57 57
             }
58
-        }catch (CBValidationException $e) {
59
-            return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
58
+        } catch (CBValidationException $e) {
59
+            return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning');
60 60
         }
61 61
     }
62 62
 
Please login to merge, or discard this patch.
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.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists("isConfigCached")) {
2
+if (!function_exists("isConfigCached")) {
3 3
     function isConfigCached()
4 4
     {
5
-        if(env("APP_NAME")=="" || env("APP_NAME")==null) return true;
5
+        if (env("APP_NAME") == "" || env("APP_NAME") == null) return true;
6 6
         else return false;
7 7
     }
8 8
 }
9 9
 
10
-if(!function_exists("miscellanousSingleton")) {
10
+if (!function_exists("miscellanousSingleton")) {
11 11
     /**
12 12
      * @return \crocodicstudio\crudbooster\helpers\MiscellanousSingleton
13 13
      */
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
     }
17 17
 }
18 18
 
19
-if(!function_exists("makeReferalUrl")) {
19
+if (!function_exists("makeReferalUrl")) {
20 20
     function makeReferalUrl($name = null) {
21 21
         $ref = [];
22 22
         $ref['url'] = request()->fullUrl();
23 23
         $ref['name'] = $name;
24 24
         $md5Hash = md5(serialize($ref));
25 25
 
26
-        if($exist = \Illuminate\Support\Facades\Cache::get("refurl_".$md5Hash)) {
26
+        if ($exist = \Illuminate\Support\Facades\Cache::get("refurl_".$md5Hash)) {
27 27
             return $exist['id'];
28 28
         }
29 29
 
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
     }
36 36
 }
37 37
 
38
-if(!function_exists("getReferalUrl")) {
38
+if (!function_exists("getReferalUrl")) {
39 39
     function getReferalUrl($key = null) {
40
-        if(verifyReferalUrl()) {
40
+        if (verifyReferalUrl()) {
41 41
             $md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"));
42 42
             $ref = \Illuminate\Support\Facades\Cache::get("refurl_".$md5hash);
43
-            if($key) {
43
+            if ($key) {
44 44
                 return @$ref[$key];
45 45
             } else {
46 46
                 return $ref;
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
     }
51 51
 }
52 52
 
53
-if(!function_exists("verifyReferalUrl")) {
53
+if (!function_exists("verifyReferalUrl")) {
54 54
     function verifyReferalUrl()
55 55
     {
56
-        if(request("ref")) {
57
-            if($md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"))) {
56
+        if (request("ref")) {
57
+            if ($md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"))) {
58 58
                 $ref = \Illuminate\Support\Facades\Cache::get("refurl_".$md5hash);
59
-                if(filter_var($ref['url'], FILTER_VALIDATE_URL)) {
59
+                if (filter_var($ref['url'], FILTER_VALIDATE_URL)) {
60 60
                     return true;
61 61
                 }
62 62
             }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     }
66 66
 }
67 67
 
68
-if(!function_exists("putHtaccess")) {
68
+if (!function_exists("putHtaccess")) {
69 69
     function putHtaccess($stringToPut)
70 70
     {
71 71
         file_put_contents(base_path(".htaccess"), "\n".$stringToPut, FILE_APPEND);
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
     }
74 74
 }
75 75
 
76
-if(!function_exists("checkHtaccess")) {
76
+if (!function_exists("checkHtaccess")) {
77 77
     function checkHtaccess($stringToCheck)
78 78
     {
79
-        if(file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) {
79
+        if (file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) {
80 80
             $htaccess = file_get_contents(base_path(".htaccess"));
81
-            $htaccess2= file_get_contents(public_path(".htaccess"));
82
-            if(\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) {
81
+            $htaccess2 = file_get_contents(public_path(".htaccess"));
82
+            if (\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) {
83 83
                 return true;
84 84
             }
85 85
         }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     }
89 89
 }
90 90
 
91
-if(!function_exists("setEnvironmentValue")) {
91
+if (!function_exists("setEnvironmentValue")) {
92 92
     function setEnvironmentValue(array $values)
93 93
     {
94 94
         $envFile = app()->environmentFilePath();
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 }
120 120
 
121 121
 
122
-if(!function_exists("cbLang")) {
122
+if (!function_exists("cbLang")) {
123 123
     /**
124 124
      * @param string $key
125 125
      * @param array $replace
@@ -131,17 +131,17 @@  discard block
 block discarded – undo
131 131
     }
132 132
 }
133 133
 
134
-if(!function_exists('rglob')) {
134
+if (!function_exists('rglob')) {
135 135
     function rglob($pattern, $flags = 0) {
136 136
         $files = glob($pattern, $flags);
137
-        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
137
+        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
138 138
             $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags));
139 139
         }
140 140
         return $files;
141 141
     }
142 142
 }
143 143
 
144
-if(!function_exists('convertPHPToMomentFormat')) {
144
+if (!function_exists('convertPHPToMomentFormat')) {
145 145
     function convertPHPToMomentFormat($format)
146 146
     {
147 147
         $replacements = [
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
     }
189 189
 }
190 190
 
191
-if(!function_exists('slug')) {
191
+if (!function_exists('slug')) {
192 192
     function slug($string, $separator = '-') {
193 193
         return \Illuminate\Support\Str::slug($string, $separator);
194 194
     }
195 195
 }
196 196
 
197
-if(!function_exists('columnSingleton')) {
197
+if (!function_exists('columnSingleton')) {
198 198
     /**
199 199
      * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton
200 200
      */
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     }
204 204
 }
205 205
 
206
-if(!function_exists('cbHook'))
206
+if (!function_exists('cbHook'))
207 207
 {
208 208
     /**
209 209
      * @return crocodicstudio\crudbooster\hooks\CBHook
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     }
216 216
 }
217 217
 
218
-if(!function_exists('getTypeHook'))
218
+if (!function_exists('getTypeHook'))
219 219
 {
220 220
     /**
221 221
      * @param string $type
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     }
229 229
 }
230 230
 
231
-if(!function_exists('getPrimaryKey'))
231
+if (!function_exists('getPrimaryKey'))
232 232
 {
233 233
     function getPrimaryKey($table_name)
234 234
     {
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     }
237 237
 }
238 238
 
239
-if(!function_exists('cb'))
239
+if (!function_exists('cb'))
240 240
 {
241 241
     function cb()
242 242
     {
@@ -244,25 +244,25 @@  discard block
 block discarded – undo
244 244
     }
245 245
 }
246 246
 
247
-if(!function_exists('cbAsset')) {
247
+if (!function_exists('cbAsset')) {
248 248
     function cbAsset($path, $secure = null) {
249 249
         return asset("cb_asset/".$path, $secure);
250 250
     }
251 251
 }
252 252
 
253
-if(!function_exists("cbConfig")) {
253
+if (!function_exists("cbConfig")) {
254 254
     function cbConfig($name, $default = null) {
255 255
         return config("crudbooster.".$name, $default);
256 256
     }
257 257
 }
258 258
 
259
-if(!function_exists("strRandom")) {
259
+if (!function_exists("strRandom")) {
260 260
     function strRandom($length = 5) {
261 261
         return \Illuminate\Support\Str::random($length);
262 262
     }
263 263
 }
264 264
 
265
-if(!function_exists('module')) {
265
+if (!function_exists('module')) {
266 266
     function module()
267 267
     {
268 268
         $module = new \crocodicstudio\crudbooster\helpers\Module();
@@ -270,21 +270,21 @@  discard block
 block discarded – undo
270 270
     }
271 271
 }
272 272
 
273
-if(!function_exists('getAdminLoginURL')) {
273
+if (!function_exists('getAdminLoginURL')) {
274 274
     function getAdminLoginURL()
275 275
     {
276 276
         return cb()->getAdminUrl("login");
277 277
     }
278 278
 }
279 279
 
280
-if(!function_exists('dummyPhoto')) {
280
+if (!function_exists('dummyPhoto')) {
281 281
     function dummyPhoto()
282 282
     {
283 283
         return cbConfig("DUMMY_PHOTO");
284 284
     }
285 285
 }
286 286
 
287
-if(!function_exists('extract_unit')) {	
287
+if (!function_exists('extract_unit')) {	
288 288
 	/*
289 289
 	Credits: Bit Repository
290 290
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
@@ -309,14 +309,14 @@  discard block
 block discarded – undo
309 309
 |
310 310
 */
311 311
 
312
-if(!function_exists('putSetting')) {
312
+if (!function_exists('putSetting')) {
313 313
     function putSetting($key, $value)
314 314
     {
315
-        if(file_exists(storage_path('.cbconfig'))) {
315
+        if (file_exists(storage_path('.cbconfig'))) {
316 316
             $settings = file_get_contents(storage_path('.cbconfig'));
317 317
             $settings = decrypt($settings);
318 318
             $settings = unserialize($settings);
319
-        }else{
319
+        } else {
320 320
             $settings = [];
321 321
         }
322 322
 
@@ -330,31 +330,31 @@  discard block
 block discarded – undo
330 330
     }
331 331
 }
332 332
 
333
-if(!function_exists('getSetting')) {
333
+if (!function_exists('getSetting')) {
334 334
     function getSetting($key, $default = null)
335 335
     {
336
-        if($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) {
336
+        if ($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) {
337 337
             return $cache;
338 338
         }
339 339
 
340
-        if(file_exists(storage_path('.cbconfig'))) {
340
+        if (file_exists(storage_path('.cbconfig'))) {
341 341
             $settings = file_get_contents(storage_path('.cbconfig'));
342 342
             $settings = decrypt($settings);
343 343
             $settings = unserialize($settings);
344
-        }else{
344
+        } else {
345 345
             $settings = [];
346 346
         }
347 347
 
348
-        if(isset($settings[$key])) {
348
+        if (isset($settings[$key])) {
349 349
             \Illuminate\Support\Facades\Cache::forever("setting_".$key, $settings[$key]);
350
-            return $settings[$key]?:$default;
351
-        }else{
350
+            return $settings[$key] ?: $default;
351
+        } else {
352 352
             return $default;
353 353
         }
354 354
     }
355 355
 }
356 356
 
357
-if(!function_exists('timeAgo')) {
357
+if (!function_exists('timeAgo')) {
358 358
     function timeAgo($datetime_to, $datetime_from = null, $full = false)
359 359
     {
360 360
         $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
             }
386 386
         }
387 387
 
388
-        if (! $full) {
388
+        if (!$full) {
389 389
             $string = array_slice($string, 0, 1);
390 390
         }
391 391
 
@@ -393,22 +393,22 @@  discard block
 block discarded – undo
393 393
     }
394 394
 }
395 395
 
396
-if(!function_exists("array_map_r")) {
397
-    function array_map_r( $func, $arr )
396
+if (!function_exists("array_map_r")) {
397
+    function array_map_r($func, $arr)
398 398
     {
399 399
         $newArr = array();
400 400
 
401
-        foreach( $arr as $key => $value )
401
+        foreach ($arr as $key => $value)
402 402
         {
403 403
             $key = $func($key);
404
-            $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) );
404
+            $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value)));
405 405
         }
406 406
 
407 407
         return $newArr;
408 408
     }
409 409
 }
410 410
 
411
-if(!function_exists("sanitizeXSS"))
411
+if (!function_exists("sanitizeXSS"))
412 412
 {
413 413
     function sanitizeXSS($value)
414 414
     {
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
     }
421 421
 }
422 422
 
423
-if(!function_exists("requestAll")) {
423
+if (!function_exists("requestAll")) {
424 424
     function requestAll() {
425 425
         $all = array_map_r("sanitizeXSS", request()->all());
426 426
         return $all;
@@ -429,22 +429,22 @@  discard block
 block discarded – undo
429 429
 
430 430
 
431 431
 
432
-if(!function_exists('getURLFormat')) {
432
+if (!function_exists('getURLFormat')) {
433 433
     function getURLFormat($name) {
434 434
         $url = request($name);
435
-        if(filter_var($url, FILTER_VALIDATE_URL)) {
435
+        if (filter_var($url, FILTER_VALIDATE_URL)) {
436 436
             return $url;
437
-        }else{
437
+        } else {
438 438
             return request()->url();
439 439
         }
440 440
     }
441 441
 }
442 442
 
443
-if(!function_exists('g')) {
443
+if (!function_exists('g')) {
444 444
     function g($name, $safe = true) {
445
-        if($safe == true) {
445
+        if ($safe == true) {
446 446
             $response = request($name);
447
-            if(is_string($response)) {
447
+            if (is_string($response)) {
448 448
                 $response = sanitizeXSS($response);
449 449
             }elseif (is_array($response)) {
450 450
                 array_walk_recursive($response, function(&$response) {
@@ -453,25 +453,25 @@  discard block
 block discarded – undo
453 453
             }
454 454
 
455 455
             return $response;
456
-        }else{
456
+        } else {
457 457
             return Request::get($name);
458 458
         }
459 459
     }
460 460
 }
461 461
 
462
-if(!function_exists('min_var_export')) {
462
+if (!function_exists('min_var_export')) {
463 463
     function min_var_export($input) {
464
-        if(is_array($input)) {
464
+        if (is_array($input)) {
465 465
             $buffer = [];
466
-            foreach($input as $key => $value)
466
+            foreach ($input as $key => $value)
467 467
                 $buffer[] = var_export($key, true)."=>".min_var_export($value);
468
-            return "[".implode(",",$buffer)."]";
468
+            return "[".implode(",", $buffer)."]";
469 469
         } else
470 470
             return var_export($input, true);
471 471
     }
472 472
 }
473 473
 
474
-if(!function_exists('rrmdir')) {
474
+if (!function_exists('rrmdir')) {
475 475
 	/*
476 476
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
477 477
 	*/
Please login to merge, or discard this patch.
Braces   +25 added lines, -17 removed lines patch added patch discarded remove patch
@@ -2,8 +2,11 @@  discard block
 block discarded – undo
2 2
 if(!function_exists("isConfigCached")) {
3 3
     function isConfigCached()
4 4
     {
5
-        if(env("APP_NAME")=="" || env("APP_NAME")==null) return true;
6
-        else return false;
5
+        if(env("APP_NAME")=="" || env("APP_NAME")==null) {
6
+            return true;
7
+        } else {
8
+            return false;
9
+        }
7 10
     }
8 11
 }
9 12
 
@@ -113,7 +116,9 @@  discard block
 block discarded – undo
113 116
         }
114 117
 
115 118
         $str = substr($str, 0, -1);
116
-        if (!file_put_contents($envFile, $str)) return false;
119
+        if (!file_put_contents($envFile, $str)) {
120
+            return false;
121
+        }
117 122
         return true;
118 123
     }
119 124
 }
@@ -316,7 +321,7 @@  discard block
 block discarded – undo
316 321
             $settings = file_get_contents(storage_path('.cbconfig'));
317 322
             $settings = decrypt($settings);
318 323
             $settings = unserialize($settings);
319
-        }else{
324
+        } else{
320 325
             $settings = [];
321 326
         }
322 327
 
@@ -341,14 +346,14 @@  discard block
 block discarded – undo
341 346
             $settings = file_get_contents(storage_path('.cbconfig'));
342 347
             $settings = decrypt($settings);
343 348
             $settings = unserialize($settings);
344
-        }else{
349
+        } else{
345 350
             $settings = [];
346 351
         }
347 352
 
348 353
         if(isset($settings[$key])) {
349 354
             \Illuminate\Support\Facades\Cache::forever("setting_".$key, $settings[$key]);
350 355
             return $settings[$key]?:$default;
351
-        }else{
356
+        } else{
352 357
             return $default;
353 358
         }
354 359
     }
@@ -434,7 +439,7 @@  discard block
 block discarded – undo
434 439
         $url = request($name);
435 440
         if(filter_var($url, FILTER_VALIDATE_URL)) {
436 441
             return $url;
437
-        }else{
442
+        } else{
438 443
             return request()->url();
439 444
         }
440 445
     }
@@ -446,14 +451,14 @@  discard block
 block discarded – undo
446 451
             $response = request($name);
447 452
             if(is_string($response)) {
448 453
                 $response = sanitizeXSS($response);
449
-            }elseif (is_array($response)) {
454
+            } elseif (is_array($response)) {
450 455
                 array_walk_recursive($response, function(&$response) {
451 456
                     $response = sanitizeXSS($response);
452 457
                 });
453 458
             }
454 459
 
455 460
             return $response;
456
-        }else{
461
+        } else{
457 462
             return Request::get($name);
458 463
         }
459 464
     }
@@ -463,11 +468,13 @@  discard block
 block discarded – undo
463 468
     function min_var_export($input) {
464 469
         if(is_array($input)) {
465 470
             $buffer = [];
466
-            foreach($input as $key => $value)
467
-                $buffer[] = var_export($key, true)."=>".min_var_export($value);
471
+            foreach($input as $key => $value) {
472
+                            $buffer[] = var_export($key, true)."=>".min_var_export($value);
473
+            }
468 474
             return "[".implode(",",$buffer)."]";
469
-        } else
470
-            return var_export($input, true);
475
+        } else {
476
+                    return var_export($input, true);
477
+        }
471 478
     }
472 479
 }
473 480
 
@@ -480,10 +487,11 @@  discard block
 block discarded – undo
480 487
 	     $objects = scandir($dir); 
481 488
 	     foreach ($objects as $object) { 
482 489
 	       if ($object != "." && $object != "..") { 
483
-	         if (is_dir($dir."/".$object))
484
-	           rrmdir($dir."/".$object);
485
-	         else
486
-	           unlink($dir."/".$object); 
490
+	         if (is_dir($dir."/".$object)) {
491
+	         	           rrmdir($dir."/".$object);
492
+	         } else {
493
+	         	           unlink($dir."/".$object);
494
+	         }
487 495
 	       } 
488 496
 	     }
489 497
 	     rmdir($dir); 
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.