Passed
Push — master ( 5403d4...38a665 )
by Ferry
04:29
created
src/commands/Install.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 
39 39
         if ($this->confirm('Do you have setting the database configuration at .env ?')) {
40 40
 
41
-            if (! file_exists(public_path('vendor')) ) {
41
+            if (!file_exists(public_path('vendor'))) {
42 42
                 mkdir(public_path('vendor'), 0777);
43 43
             }
44 44
 
Please login to merge, or discard this patch.
src/CRUDBoosterServiceProvider.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
         // Register views
25 25
         $this->loadViewsFrom(__DIR__.'/views', 'crudbooster');
26 26
         $this->loadViewsFrom(__DIR__.'/types', 'types');
27
-        $this->loadTranslationsFrom(__DIR__."/localization","cb");
27
+        $this->loadTranslationsFrom(__DIR__."/localization", "cb");
28 28
 
29 29
         // Publish the files
30
-        $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')],'cb_config');
31
-        $this->publishes([__DIR__.'/database' => base_path('database')],'cb_migration');
32
-        $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')],'cb_hook');
33
-        $this->publishes([__DIR__ . '/assets' =>public_path('cb_asset')],'cb_asset');
30
+        $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')], 'cb_config');
31
+        $this->publishes([__DIR__.'/database' => base_path('database')], 'cb_migration');
32
+        $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')], 'cb_hook');
33
+        $this->publishes([__DIR__.'/assets' =>public_path('cb_asset')], 'cb_asset');
34 34
                     
35 35
         require __DIR__.'/validations/validation.php';        
36 36
         require __DIR__.'/routes.php';
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
         require __DIR__.'/helpers/Helper.php';
49 49
 
50 50
         // Singletons
51
-        $this->app->singleton('crudbooster', function ()
51
+        $this->app->singleton('crudbooster', function()
52 52
         {
53 53
             return true;
54 54
         });
55 55
         $this->app->singleton('ColumnSingleton', ColumnSingleton::class);
56 56
 
57 57
         // Merging configuration
58
-        $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php','crudbooster');
58
+        $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php', 'crudbooster');
59 59
 
60 60
 
61 61
         // Register Commands
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
     private function registerTypeRoutes() {
79 79
         $routes = rglob(__DIR__.DIRECTORY_SEPARATOR."types".DIRECTORY_SEPARATOR."Route.php");
80
-        foreach($routes as $route) {
80
+        foreach ($routes as $route) {
81 81
             require $route;
82 82
         }
83 83
     }
Please login to merge, or discard this patch.
src/controllers/AdminAuthController.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
     public function getLogin()
10 10
     {
11
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
11
+        if (!auth()->guest()) return redirect(cb()->getAdminUrl());
12 12
 
13 13
         cbHook()->hookGetLogin();
14 14
 
@@ -17,20 +17,20 @@  discard block
 block discarded – undo
17 17
 
18 18
     public function postLogin()
19 19
     {
20
-        try{
20
+        try {
21 21
             cb()->validation([
22 22
                 'email'=>'required|email',
23 23
                 'password'=>'required'
24 24
             ]);
25
-            $credential = request()->only(['email','password']);
25
+            $credential = request()->only(['email', 'password']);
26 26
             if (auth()->attempt($credential)) {
27 27
                 cbHook()->hookPostLogin();
28 28
                 return redirect(cb()->getAdminUrl());
29 29
             } else {
30
-                return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.password_and_username_is_wrong'),'message_type'=>'warning']);
30
+                return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.password_and_username_is_wrong'), 'message_type'=>'warning']);
31 31
             }
32
-        }catch (CBValidationException $e) {
33
-            return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
32
+        } catch (CBValidationException $e) {
33
+            return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning');
34 34
         }
35 35
     }
36 36
 
@@ -45,25 +45,25 @@  discard block
 block discarded – undo
45 45
     }
46 46
 
47 47
     public function postLoginDeveloper() {
48
-        try{
48
+        try {
49 49
             cb()->validation([
50 50
                 'username'=>'required',
51 51
                 'password'=>'required'
52 52
             ]);
53 53
 
54
-            if(request('username') == getSetting('developer_username')
54
+            if (request('username') == getSetting('developer_username')
55 55
                 && request('password') == getSetting("developer_password")) {
56 56
 
57 57
                 session(['developer'=>1]);
58 58
 
59 59
                 return redirect(cb()->getDeveloperUrl());
60 60
 
61
-            }else{
61
+            } else {
62 62
                 return cb()->redirectBack(__("crudbooster.password_and_username_is_wrong"));
63 63
             }
64 64
 
65
-        }catch (CBValidationException $e) {
66
-            return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning');
65
+        } catch (CBValidationException $e) {
66
+            return cb()->redirect(cb()->getLoginUrl(), $e->getMessage(), 'warning');
67 67
         }
68 68
     }
69 69
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 
9 9
     public function getLogin()
10 10
     {
11
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
11
+        if(!auth()->guest()) {
12
+            return redirect(cb()->getAdminUrl());
13
+        }
12 14
 
13 15
         cbHook()->hookGetLogin();
14 16
 
@@ -29,7 +31,7 @@  discard block
 block discarded – undo
29 31
             } else {
30 32
                 return redirect(cb()->getLoginUrl())->with(['message'=>__('crudbooster.password_and_username_is_wrong'),'message_type'=>'warning']);
31 33
             }
32
-        }catch (CBValidationException $e) {
34
+        } catch (CBValidationException $e) {
33 35
             return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
34 36
         }
35 37
     }
@@ -58,11 +60,11 @@  discard block
 block discarded – undo
58 60
 
59 61
                 return redirect(cb()->getDeveloperUrl());
60 62
 
61
-            }else{
63
+            } else{
62 64
                 return cb()->redirectBack(__("crudbooster.password_and_username_is_wrong"));
63 65
             }
64 66
 
65
-        }catch (CBValidationException $e) {
67
+        } catch (CBValidationException $e) {
66 68
             return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning');
67 69
         }
68 70
     }
Please login to merge, or discard this patch.
src/controllers/DeveloperModulesController.php 2 patches
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
     public function getIndex() {
32 32
         $data = [];
33 33
         $data['result'] = DB::table("cb_modules")->get();
34
-        return view($this->view.'.index',$data);
34
+        return view($this->view.'.index', $data);
35 35
     }
36 36
 
37 37
     public function getAdd() {
38 38
         $data = [];
39 39
         $data['tables'] = cb()->listAllTable();
40
-        $data['module'] = (request('modules_id'))?cb()->find("cb_modules", request("modules_id")):null;
40
+        $data['module'] = (request('modules_id')) ?cb()->find("cb_modules", request("modules_id")) : null;
41 41
         return view($this->view.'.add', $data);
42 42
     }
43 43
 
@@ -50,17 +50,17 @@  discard block
 block discarded – undo
50 50
         $data = cb()->listAllColumns($table);
51 51
         $pk = cb()->findPrimaryKey($table);
52 52
         $result = [];
53
-        foreach($data as $item) {
53
+        foreach ($data as $item) {
54 54
 
55
-            if(Str::contains(strtolower($item),["title","name","label"])) {
55
+            if (Str::contains(strtolower($item), ["title", "name", "label"])) {
56 56
                 $display = true;
57
-            }else{
57
+            } else {
58 58
                 $display = false;
59 59
             }
60 60
 
61 61
             $result[] = [
62 62
                 "column"=>$item,
63
-                "primary_key"=>($pk==$item)?true:false,
63
+                "primary_key"=>($pk == $item) ?true:false,
64 64
                 "display"=>$display
65 65
             ];
66 66
         }
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 
70 70
     public function getColumns($table)
71 71
     {
72
-        if(request("modules_id")) {
73
-            $module = cb()->find("cb_modules",request("modules_id"));
74
-            if($module->last_column_build) {
72
+        if (request("modules_id")) {
73
+            $module = cb()->find("cb_modules", request("modules_id"));
74
+            if ($module->last_column_build) {
75 75
                 return response()->json(json_decode($module->last_column_build));
76 76
             }
77 77
         }
@@ -79,46 +79,46 @@  discard block
 block discarded – undo
79 79
         $columns = cb()->listAllColumns($table);
80 80
         $pk = cb()->findPrimaryKey($table);
81 81
         $result = [];
82
-        foreach($columns as $column) {
83
-            if($column != $pk) {
82
+        foreach ($columns as $column) {
83
+            if ($column != $pk) {
84 84
 
85 85
                 // Check if any relation table candidate
86 86
                 $optionTable = "";
87
-                if(Str::substr(strtolower($column),-3,3) == "_id") {
88
-                    $relationTable = Str::substr($column,0,-3);
89
-                    if(Schema::hasTable($relationTable)) {
87
+                if (Str::substr(strtolower($column), -3, 3) == "_id") {
88
+                    $relationTable = Str::substr($column, 0, -3);
89
+                    if (Schema::hasTable($relationTable)) {
90 90
                         $optionTable = $relationTable;
91 91
                     }
92
-                }elseif (Str::substr(strtolower($column),0,3) == "id_") {
93
-                    $relationTable = Str::substr($column,3);
94
-                    if(Schema::hasTable($relationTable)) {
92
+                }elseif (Str::substr(strtolower($column), 0, 3) == "id_") {
93
+                    $relationTable = Str::substr($column, 3);
94
+                    if (Schema::hasTable($relationTable)) {
95 95
                         $optionTable = $relationTable;
96 96
                     }
97 97
                 }
98 98
 
99
-                $label = trim(Str::title(str_replace(["id_","_id","_"]," ",$column)));
99
+                $label = trim(Str::title(str_replace(["id_", "_id", "_"], " ", $column)));
100 100
                 $label = Str::singular($label);
101 101
                 $type = "text";
102 102
 
103
-                if(Str::contains(strtolower($label),["photo","image","picture","gambar"])) {
103
+                if (Str::contains(strtolower($label), ["photo", "image", "picture", "gambar"])) {
104 104
                     $type = "image";
105
-                }elseif (Str::contains(strtolower($label),["email","mail"])) {
105
+                }elseif (Str::contains(strtolower($label), ["email", "mail"])) {
106 106
                     $type = "email";
107
-                }elseif (Str::contains(strtolower($label),["description","content","detail"])) {
108
-                    $type =  "wysiwyg";
109
-                }elseif (Str::contains(strtolower($label),["price","money","grand_total","tax"])) {
107
+                }elseif (Str::contains(strtolower($label), ["description", "content", "detail"])) {
108
+                    $type = "wysiwyg";
109
+                }elseif (Str::contains(strtolower($label), ["price", "money", "grand_total", "tax"])) {
110 110
                     $type = "money";
111
-                }elseif (Str::contains(strtolower($label),["quantity","qty","total","phone","telp"])) {
111
+                }elseif (Str::contains(strtolower($label), ["quantity", "qty", "total", "phone", "telp"])) {
112 112
                     $type = "number";
113
-                }elseif (Str::contains(strtolower($label),["date"])) {
113
+                }elseif (Str::contains(strtolower($label), ["date"])) {
114 114
                     $type = "date";
115 115
                 }
116 116
 
117
-                if (Str::substr(strtolower($column),-3,3) == "_id") {
117
+                if (Str::substr(strtolower($column), -3, 3) == "_id") {
118 118
                     $type = "select_table";
119 119
                 } elseif (Str::substr($column, -3, 3) == "_at") {
120 120
                     $type = "datetime";
121
-                } elseif (Str::substr($column,0, 3) == "id_") {
121
+                } elseif (Str::substr($column, 0, 3) == "id_") {
122 122
                     $type = "select_table";
123 123
                 }
124 124
 
@@ -164,39 +164,39 @@  discard block
 block discarded – undo
164 164
     public function postCreateMigration()
165 165
     {
166 166
         try {
167
-            cb()->validation(['table_name','structures']);
167
+            cb()->validation(['table_name', 'structures']);
168 168
 
169 169
             $tableName = request("table_name");
170 170
 
171
-            if(!Schema::hasTable($tableName)) {
171
+            if (!Schema::hasTable($tableName)) {
172 172
                 $filenameMigration = date("Y_m_d_His")."_".$tableName.".php";
173 173
                 $createTemplate = file_get_contents(base_path("vendor/laravel/framework/src/Illuminate/Database/Migrations/stubs/create.stub"));
174 174
                 $className = Str::studly($tableName);
175 175
                 $createTemplate = str_replace("DummyClass", $className, $createTemplate);
176 176
                 $createTemplate = str_replace("DummyTable", $tableName, $createTemplate);
177
-                $createTemplate = str_replace("\$table->increments('id');","",$createTemplate);
177
+                $createTemplate = str_replace("\$table->increments('id');", "", $createTemplate);
178 178
 
179 179
                 $structureItems = "";
180 180
 
181
-                if(request("timestamp")) {
181
+                if (request("timestamp")) {
182 182
                     $structureItems .= "\$table->timestamps();\n\t\t\t";
183 183
                 }
184 184
 
185
-                if(request("soft_deletes")) {
185
+                if (request("soft_deletes")) {
186 186
                     $structureItems .= "\$table->softDeletes();\n\t\t\t";
187 187
                 }
188 188
 
189
-                foreach(request("structures") as $item) {
189
+                foreach (request("structures") as $item) {
190 190
 
191 191
                     $nullable = "";
192 192
 
193
-                    if(!in_array($item['type_data'],["bigIncrements","increments","mediumIncrements","smallIncrements"])) {
193
+                    if (!in_array($item['type_data'], ["bigIncrements", "increments", "mediumIncrements", "smallIncrements"])) {
194 194
                         $nullable = "->nullable()";
195 195
                     }
196 196
 
197
-                    if($item['length']) {
197
+                    if ($item['length']) {
198 198
                         $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."', ".$item['length'].")$nullable;\n\t\t\t";
199
-                    }else{
199
+                    } else {
200 200
                         $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."')$nullable;\n\t\t\t";
201 201
                     }
202 202
                 }
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
             }
216 216
 
217 217
         } catch (CBValidationException $e) {
218
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
218
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
219 219
         } catch (\Exception $e) {
220
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
220
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
221 221
         }
222 222
 
223
-        return response()->json(['status'=>true,'message'=>'Migration successfully!']);
223
+        return response()->json(['status'=>true, 'message'=>'Migration successfully!']);
224 224
     }
225 225
 
226 226
     public function postCheckExistModule()
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
         try {
229 229
             cb()->validation(['name', 'table']);
230 230
 
231
-            if(DB::table("cb_modules")->where("table_name",request("table"))->where("name",request("name"))->count()) {
231
+            if (DB::table("cb_modules")->where("table_name", request("table"))->where("name", request("name"))->count()) {
232 232
                 return response()->json(['status'=>true]);
233 233
             }
234 234
 
235 235
         } catch (CBValidationException $e) {
236
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
236
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
237 237
         }
238 238
 
239 239
         return response()->json(['status'=>false]);
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
     public function postAddSave() {
243 243
 
244 244
         try {
245
-            cb()->validation(['name', 'table','icon','columns']);
245
+            cb()->validation(['name', 'table', 'icon', 'columns']);
246 246
 
247 247
             $module = (new ModuleGenerator(request('table'), request('name'), request('icon'), request("columns"), request("rebuild")))->make();
248 248
 
249 249
         } catch (CBValidationException $e) {
250
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
250
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
251 251
         }
252 252
 
253 253
         return response()->json(['status'=>true, 'message'=>'Please remember that you can still modify the structure by edit the controller file '.$module['controller'].' :)']);
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
         try {
264 264
             cb()->validation(['name', 'icon']);
265 265
 
266
-            cb()->updateCompact("cb_modules", $id, ['name','icon']);
266
+            cb()->updateCompact("cb_modules", $id, ['name', 'icon']);
267 267
 
268
-            return cb()->redirect(route("DeveloperModulesControllerGetIndex"),"Module has been updated!","success");
268
+            return cb()->redirect(route("DeveloperModulesControllerGetIndex"), "Module has been updated!", "success");
269 269
 
270 270
         } catch (CBValidationException $e) {
271 271
             return cb()->redirectBack($e->getMessage());
@@ -273,18 +273,18 @@  discard block
 block discarded – undo
273 273
     }
274 274
 
275 275
     public function getDelete($id) {
276
-        $module = cb()->find("cb_modules",$id);
276
+        $module = cb()->find("cb_modules", $id);
277 277
         @unlink(app_path("Http/Controllers/".$module->controller.".php"));
278 278
         DB::table("cb_modules")->where("id", $id)->delete();
279 279
         DB::table("cb_menus")->where("cb_modules_id", $id)->delete();
280
-        return cb()->redirectBack("The module has been deleted!","success");
280
+        return cb()->redirectBack("The module has been deleted!", "success");
281 281
     }
282 282
 
283 283
     public function getDeleteSoft($id) {
284
-        $module = cb()->find("cb_modules",$id);
284
+        $module = cb()->find("cb_modules", $id);
285 285
         DB::table("cb_modules")->where("id", $id)->delete();
286 286
         DB::table("cb_menus")->where("cb_modules_id", $id)->delete();
287
-        return cb()->redirectBack("The module has been deleted!","success");
287
+        return cb()->redirectBack("The module has been deleted!", "success");
288 288
     }
289 289
 
290 290
 }
291 291
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
             if(Str::contains(strtolower($item),["title","name","label"])) {
56 56
                 $display = true;
57
-            }else{
57
+            } else{
58 58
                 $display = false;
59 59
             }
60 60
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
                     if(Schema::hasTable($relationTable)) {
90 90
                         $optionTable = $relationTable;
91 91
                     }
92
-                }elseif (Str::substr(strtolower($column),0,3) == "id_") {
92
+                } elseif (Str::substr(strtolower($column),0,3) == "id_") {
93 93
                     $relationTable = Str::substr($column,3);
94 94
                     if(Schema::hasTable($relationTable)) {
95 95
                         $optionTable = $relationTable;
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
 
103 103
                 if(Str::contains(strtolower($label),["photo","image","picture","gambar"])) {
104 104
                     $type = "image";
105
-                }elseif (Str::contains(strtolower($label),["email","mail"])) {
105
+                } elseif (Str::contains(strtolower($label),["email","mail"])) {
106 106
                     $type = "email";
107
-                }elseif (Str::contains(strtolower($label),["description","content","detail"])) {
107
+                } elseif (Str::contains(strtolower($label),["description","content","detail"])) {
108 108
                     $type =  "wysiwyg";
109
-                }elseif (Str::contains(strtolower($label),["price","money","grand_total","tax"])) {
109
+                } elseif (Str::contains(strtolower($label),["price","money","grand_total","tax"])) {
110 110
                     $type = "money";
111
-                }elseif (Str::contains(strtolower($label),["quantity","qty","total","phone","telp"])) {
111
+                } elseif (Str::contains(strtolower($label),["quantity","qty","total","phone","telp"])) {
112 112
                     $type = "number";
113
-                }elseif (Str::contains(strtolower($label),["date"])) {
113
+                } elseif (Str::contains(strtolower($label),["date"])) {
114 114
                     $type = "date";
115 115
                 }
116 116
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
                     if($item['length']) {
198 198
                         $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."', ".$item['length'].")$nullable;\n\t\t\t";
199
-                    }else{
199
+                    } else{
200 200
                         $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."')$nullable;\n\t\t\t";
201 201
                     }
202 202
                 }
Please login to merge, or discard this patch.
src/controllers/DeveloperRolesController.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
     public function getIndex() {
26 26
         $data = [];
27 27
         $data['result'] = DB::table("cb_roles")->get();
28
-        return view($this->view.".index",$data);
28
+        return view($this->view.".index", $data);
29 29
     }
30 30
 
31 31
     public function getAdd() {
32 32
         $data = [];
33
-        $data['menus'] = DB::table("cb_menus")->orderBy("name","asc")->get();
33
+        $data['menus'] = DB::table("cb_menus")->orderBy("name", "asc")->get();
34 34
         return view($this->view.".add", $data);
35 35
     }
36 36
 
@@ -49,17 +49,17 @@  discard block
 block discarded – undo
49 49
                 $privilege = [];
50 50
                 $privilege["cb_roles_id"] = $roles_id;
51 51
                 $privilege["cb_menus_id"] = $menus_id;
52
-                $privilege["can_browse"]  = @$access['can_browse']?:0;
53
-                $privilege["can_create"] = @$access['can_create']?:0;
54
-                $privilege["can_read"] = @$access['can_read']?:0;
55
-                $privilege["can_update"] = @$access['can_update']?:0;
56
-                $privilege["can_delete"] = @$access['can_delete']?:0;
52
+                $privilege["can_browse"]  = @$access['can_browse'] ?: 0;
53
+                $privilege["can_create"] = @$access['can_create'] ?: 0;
54
+                $privilege["can_read"] = @$access['can_read'] ?: 0;
55
+                $privilege["can_update"] = @$access['can_update'] ?: 0;
56
+                $privilege["can_delete"] = @$access['can_delete'] ?: 0;
57 57
                 DB::table("cb_role_privileges")->insert($privilege);
58 58
             }
59 59
 
60 60
             DB::commit();
61 61
 
62
-            return cb()->redirect(route("DeveloperRolesControllerGetIndex"),"The role has been saved!","success");
62
+            return cb()->redirect(route("DeveloperRolesControllerGetIndex"), "The role has been saved!", "success");
63 63
 
64 64
         } catch (CBValidationException $e) {
65 65
             return cb()->redirectBack($e->getMessage());
@@ -74,21 +74,21 @@  discard block
 block discarded – undo
74 74
         $data['row'] = cb()->find("cb_roles", $id);
75 75
 
76 76
         $menus = DB::table("cb_menus")
77
-        ->leftjoin("cb_role_privileges",function($join) use ($id) {
78
-            $join->on("cb_role_privileges.cb_menus_id","=","cb_menus.id")->where("cb_role_privileges.cb_roles_id", $id);
77
+        ->leftjoin("cb_role_privileges", function($join) use ($id) {
78
+            $join->on("cb_role_privileges.cb_menus_id", "=", "cb_menus.id")->where("cb_role_privileges.cb_roles_id", $id);
79 79
         })
80
-        ->orderBy("cb_menus.name","asc")
81
-        ->select("cb_menus.*","can_browse","can_create","can_read","can_update","can_delete")
80
+        ->orderBy("cb_menus.name", "asc")
81
+        ->select("cb_menus.*", "can_browse", "can_create", "can_read", "can_update", "can_delete")
82 82
         ->get();
83 83
         $data['menus'] = $menus;
84 84
 
85
-        return view($this->view.".edit",$data);
85
+        return view($this->view.".edit", $data);
86 86
     }
87 87
 
88 88
     private function existsPrivilege($cb_roles_id, $cb_menus_id) {
89
-        if($row = cb()->find("cb_role_privileges",['cb_roles_id'=>$cb_roles_id,'cb_menus_id'=>$cb_menus_id])) {
89
+        if ($row = cb()->find("cb_role_privileges", ['cb_roles_id'=>$cb_roles_id, 'cb_menus_id'=>$cb_menus_id])) {
90 90
             return $row->id;
91
-        }else{
91
+        } else {
92 92
             return null;
93 93
         }
94 94
     }
@@ -97,26 +97,26 @@  discard block
 block discarded – undo
97 97
         try {
98 98
             cb()->validation(['name', 'menus']);
99 99
 
100
-            cb()->updateCompact("cb_roles",$id,['name']);
100
+            cb()->updateCompact("cb_roles", $id, ['name']);
101 101
 
102 102
             foreach (request("menus") as $menus_id) {
103 103
                 @$access = request("access")[$menus_id];
104 104
                 $privilege = [];
105 105
                 $privilege["cb_roles_id"] = $id;
106 106
                 $privilege["cb_menus_id"] = $menus_id;
107
-                $privilege["can_browse"]  = @$access['can_browse']?:0;
108
-                $privilege["can_create"] = @$access['can_create']?:0;
109
-                $privilege["can_read"] = @$access['can_read']?:0;
110
-                $privilege["can_update"] = @$access['can_update']?:0;
111
-                $privilege["can_delete"] = @$access['can_delete']?:0;
112
-                if($privilege_id = $this->existsPrivilege($id, $menus_id)) {
107
+                $privilege["can_browse"]  = @$access['can_browse'] ?: 0;
108
+                $privilege["can_create"] = @$access['can_create'] ?: 0;
109
+                $privilege["can_read"] = @$access['can_read'] ?: 0;
110
+                $privilege["can_update"] = @$access['can_update'] ?: 0;
111
+                $privilege["can_delete"] = @$access['can_delete'] ?: 0;
112
+                if ($privilege_id = $this->existsPrivilege($id, $menus_id)) {
113 113
                     DB::table("cb_role_privileges")->where("id", $privilege_id)->update($privilege);
114
-                }else{
114
+                } else {
115 115
                     DB::table("cb_role_privileges")->insert($privilege);
116 116
                 }
117 117
             }
118 118
 
119
-            return cb()->redirect(route("DeveloperRolesControllerGetIndex"),"The role has been saved!","success");
119
+            return cb()->redirect(route("DeveloperRolesControllerGetIndex"), "The role has been saved!", "success");
120 120
 
121 121
         } catch (CBValidationException $e) {
122 122
 
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 
127 127
     public function getDelete($id) {
128 128
         DB::table("cb_roles")->where("id", $id)->delete();
129
-        DB::table("cb_role_privileges")->where("cb_roles_id",$id)->delete();
129
+        DB::table("cb_role_privileges")->where("cb_roles_id", $id)->delete();
130 130
 
131
-        return cb()->redirect(route("DeveloperRolesControllerGetIndex"), "The role has been deleted!","success");
131
+        return cb()->redirect(route("DeveloperRolesControllerGetIndex"), "The role has been deleted!", "success");
132 132
     }
133 133
 
134 134
 }
135 135
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     private function existsPrivilege($cb_roles_id, $cb_menus_id) {
89 89
         if($row = cb()->find("cb_role_privileges",['cb_roles_id'=>$cb_roles_id,'cb_menus_id'=>$cb_menus_id])) {
90 90
             return $row->id;
91
-        }else{
91
+        } else{
92 92
             return null;
93 93
         }
94 94
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                 $privilege["can_delete"] = @$access['can_delete']?:0;
112 112
                 if($privilege_id = $this->existsPrivilege($id, $menus_id)) {
113 113
                     DB::table("cb_role_privileges")->where("id", $privilege_id)->update($privilege);
114
-                }else{
114
+                } else{
115 115
                     DB::table("cb_role_privileges")->insert($privilege);
116 116
                 }
117 117
             }
Please login to merge, or discard this patch.
src/controllers/scaffolding/traits/ColumnsRegister.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
         $data = new TextModel();
60 60
         $data = $this->setDefaultModelValue($data);
61 61
         $data->setLabel($label);
62
-        $data->setName($this->name($label,$name));
63
-        $data->setField($field_to_save?:$this->name($label, $name));
62
+        $data->setName($this->name($label, $name));
63
+        $data->setField($field_to_save ?: $this->name($label, $name));
64 64
         $data->setType("text");
65 65
 
66 66
         columnSingleton()->setColumn($this->index, $data);
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
         $data = new CheckboxModel();
76 76
         $data = $this->setDefaultModelValue($data);
77 77
         $data->setLabel($label);
78
-        $data->setName($this->name($label,$name));
79
-        $data->setField($field_to_save?:$this->name($label, $name));
78
+        $data->setName($this->name($label, $name));
79
+        $data->setField($field_to_save ?: $this->name($label, $name));
80 80
         $data->setType("checkbox");
81 81
 
82 82
         columnSingleton()->setColumn($this->index, $data);
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
         $data = new PasswordModel();
92 92
         $data = $this->setDefaultModelValue($data);
93 93
         $data->setLabel($label);
94
-        $data->setName($this->name($label,$name));
95
-        $data->setField($field_to_save?:$this->name($label, $name));
94
+        $data->setName($this->name($label, $name));
95
+        $data->setField($field_to_save ?: $this->name($label, $name));
96 96
         $data->setType("password");
97 97
         $data->setShowDetail(false);
98 98
         $data->setShowIndex(false);
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
         $data = new ImageModel();
110 110
         $data = $this->setDefaultModelValue($data);
111 111
         $data->setLabel($label);
112
-        $data->setName($this->name($label,$name));
113
-        $data->setField($field_to_save?:$this->name($label, $name));
112
+        $data->setName($this->name($label, $name));
113
+        $data->setField($field_to_save ?: $this->name($label, $name));
114 114
         $data->setType("image");
115 115
 
116 116
         columnSingleton()->setColumn($this->index, $data);
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
         $data = new TextAreaModel();
126 126
         $data = $this->setDefaultModelValue($data);
127 127
         $data->setLabel($label);
128
-        $data->setName($this->name($label,$name));
129
-        $data->setField($field_to_save?:$this->name($label, $name));
128
+        $data->setName($this->name($label, $name));
129
+        $data->setField($field_to_save ?: $this->name($label, $name));
130 130
         $data->setType("text_area");
131 131
 
132 132
         columnSingleton()->setColumn($this->index, $data);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $data = new SelectTableModel();
142 142
         $data = $this->setDefaultModelValue($data);
143 143
         $data->setLabel($label);
144
-        $data->setName($this->name($label,$name));
144
+        $data->setName($this->name($label, $name));
145 145
         $data->setField($this->name($label, $name));
146 146
         $data->setType("select_table");
147 147
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 
150 150
         $selectTable = new SelectTable($this->index);
151 151
 
152
-        if($selectConfig) {
153
-            $selectTable->optionsFromTable($selectConfig['table'],$selectConfig['value_option'],$selectConfig['display_option'],@$selectConfig['sql_condition']);
152
+        if ($selectConfig) {
153
+            $selectTable->optionsFromTable($selectConfig['table'], $selectConfig['value_option'], $selectConfig['display_option'], @$selectConfig['sql_condition']);
154 154
         }
155 155
 
156 156
         return $selectTable;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         $data = new SelectOptionModel();
164 164
         $data = $this->setDefaultModelValue($data);
165 165
         $data->setLabel($label);
166
-        $data->setName($this->name($label,$name));
166
+        $data->setName($this->name($label, $name));
167 167
         $data->setField($this->name($label, $name));
168 168
         $data->setType("select_option");
169 169
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
         $selectOption = new SelectOption($this->index);
173 173
 
174
-        if($options) {
174
+        if ($options) {
175 175
             $selectOption->options($options);
176 176
         }
177 177
 
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
         $data = new SelectQueryModel();
192 192
         $data = $this->setDefaultModelValue($data);
193 193
         $data->setLabel($label);
194
-        $data->setName($this->name($label,$name));
194
+        $data->setName($this->name($label, $name));
195 195
         $data->setField($this->name($label, $name));
196 196
         $data->setType("select_query");
197 197
 
198 198
         columnSingleton()->setColumn($this->index, $data);
199 199
 
200
-        $selectQuery =new SelectQuery($this->index);
200
+        $selectQuery = new SelectQuery($this->index);
201 201
 
202
-        if($query) {
202
+        if ($query) {
203 203
             $selectQuery->optionsFromQuery($query);
204 204
         }
205 205
 
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
         $data = new CustomModel();
215 215
         $data = $this->setDefaultModelValue($data);
216 216
         $data->setLabel($label);
217
-        $data->setName($this->name($label,$name));
218
-        $data->setField($field_to_save?:$this->name($label, $name));
217
+        $data->setName($this->name($label, $name));
218
+        $data->setField($field_to_save ?: $this->name($label, $name));
219 219
         $data->setType("custom");
220 220
 
221 221
         columnSingleton()->setColumn($this->index, $data);
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
         $data = new DateModel();
231 231
         $data = $this->setDefaultModelValue($data);
232 232
         $data->setLabel($label);
233
-        $data->setName($this->name($label,$name));
234
-        $data->setField($field_to_save?:$this->name($label, $name));
233
+        $data->setName($this->name($label, $name));
234
+        $data->setField($field_to_save ?: $this->name($label, $name));
235 235
         $data->setType("date");
236 236
 
237 237
         columnSingleton()->setColumn($this->index, $data);
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
         $data = new DatetimeModel();
247 247
         $data = $this->setDefaultModelValue($data);
248 248
         $data->setLabel($label);
249
-        $data->setName($this->name($label,$name));
250
-        $data->setField($field_to_save?:$this->name($label, $name));
249
+        $data->setName($this->name($label, $name));
250
+        $data->setField($field_to_save ?: $this->name($label, $name));
251 251
         $data->setType("datetime");
252 252
 
253 253
         columnSingleton()->setColumn($this->index, $data);
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
         $data = new EmailModel();
263 263
         $data = $this->setDefaultModelValue($data);
264 264
         $data->setLabel($label);
265
-        $data->setName($this->name($label,$name));
266
-        $data->setField($field_to_save?:$this->name($label, $name));
265
+        $data->setName($this->name($label, $name));
266
+        $data->setField($field_to_save ?: $this->name($label, $name));
267 267
         $data->setType("email");
268 268
 
269 269
         columnSingleton()->setColumn($this->index, $data);
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
         $data = new FileModel();
279 279
         $data = $this->setDefaultModelValue($data);
280 280
         $data->setLabel($label);
281
-        $data->setName($this->name($label,$name));
282
-        $data->setField($field_to_save?:$this->name($label, $name));
281
+        $data->setName($this->name($label, $name));
282
+        $data->setField($field_to_save ?: $this->name($label, $name));
283 283
         $data->setType("file");
284 284
 
285 285
         columnSingleton()->setColumn($this->index, $data);
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
         $data = new HiddenModel();
296 296
         $data = $this->setDefaultModelValue($data);
297 297
         $data->setLabel($label);
298
-        $data->setName($this->name($label,$name));
299
-        $data->setField($field_to_save?:$this->name($label, $name));
298
+        $data->setName($this->name($label, $name));
299
+        $data->setField($field_to_save ?: $this->name($label, $name));
300 300
         $data->setType("hidden");
301 301
 
302 302
         columnSingleton()->setColumn($this->index, $data);
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
         $data = new NumberModel();
312 312
         $data = $this->setDefaultModelValue($data);
313 313
         $data->setLabel($label);
314
-        $data->setName($this->name($label,$name));
315
-        $data->setField($field_to_save?:$this->name($label, $name));
314
+        $data->setName($this->name($label, $name));
315
+        $data->setField($field_to_save ?: $this->name($label, $name));
316 316
         $data->setType("number");
317 317
 
318 318
         columnSingleton()->setColumn($this->index, $data);
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
         $data = new MoneyModel();
328 328
         $data = $this->setDefaultModelValue($data);
329 329
         $data->setLabel($label);
330
-        $data->setName($this->name($label,$name));
331
-        $data->setField($field_to_save?:$this->name($label, $name));
330
+        $data->setName($this->name($label, $name));
331
+        $data->setField($field_to_save ?: $this->name($label, $name));
332 332
         $data->setType("money");
333 333
 
334 334
         columnSingleton()->setColumn($this->index, $data);
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
         $data = new RadioModel();
344 344
         $data = $this->setDefaultModelValue($data);
345 345
         $data->setLabel($label);
346
-        $data->setName($this->name($label,$name));
347
-        $data->setField($field_to_save?:$this->name($label, $name));
346
+        $data->setName($this->name($label, $name));
347
+        $data->setField($field_to_save ?: $this->name($label, $name));
348 348
         $data->setType("radio");
349 349
 
350 350
         columnSingleton()->setColumn($this->index, $data);
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
         $data = new WysiwygModel();
360 360
         $data = $this->setDefaultModelValue($data);
361 361
         $data->setLabel($label);
362
-        $data->setName($this->name($label,$name));
363
-        $data->setField($field_to_save?:$this->name($label, $name));
362
+        $data->setName($this->name($label, $name));
363
+        $data->setField($field_to_save ?: $this->name($label, $name));
364 364
         $data->setType("wysiwyg");
365 365
 
366 366
         columnSingleton()->setColumn($this->index, $data);
Please login to merge, or discard this patch.
src/helpers/ModuleGenerator.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
     }
38 38
 
39 39
     public function make() {
40
-        $name = trim(($this->name)?:ucwords(str_replace("_"," ",$this->table)));
40
+        $name = trim(($this->name) ?: ucwords(str_replace("_", " ", $this->table)));
41 41
 
42 42
         $template = file_get_contents(__DIR__."/../templates/FooBarController.stub");
43 43
 
44 44
         //Replace table
45
-        $template = str_replace("{table}",'"'.$this->table.'"', $template);
45
+        $template = str_replace("{table}", '"'.$this->table.'"', $template);
46 46
 
47 47
         //Replace permalink
48
-        $permalink = strtolower(Str::slug($name,"_"));
48
+        $permalink = strtolower(Str::slug($name, "_"));
49 49
         $template = str_replace("{permalink}", '"'.$permalink.'"', $template);
50 50
 
51 51
         //Replace Page title
@@ -53,42 +53,42 @@  discard block
 block discarded – undo
53 53
 
54 54
         //Replace scaffolding
55 55
         $scaffold = "";
56
-        foreach($this->columns as $field) {
56
+        foreach ($this->columns as $field) {
57 57
             $label = $field['column_label'];
58 58
             $column = $field['column_field'];
59
-            $help = isset($field['column_help'])?"->help(\"".$field['column_help']."\")":"";
60
-            $required = ($field['column_mandatory']=="on")?"":"->required(false)";
61
-            $indexShow = ($field['column_browse']=="on")?"":"->showIndex(false)";
62
-            $detailShow = ($field['column_detail']=="on")?"":"->showDetail(false)";
63
-            $editShow = ($field['column_edit']=="on")?"":"->showEdit(false)";
64
-            $addShow = ($field['column_add']=="on")?"":"->showAdd(false)";
59
+            $help = isset($field['column_help']) ? "->help(\"".$field['column_help']."\")" : "";
60
+            $required = ($field['column_mandatory'] == "on") ? "" : "->required(false)";
61
+            $indexShow = ($field['column_browse'] == "on") ? "" : "->showIndex(false)";
62
+            $detailShow = ($field['column_detail'] == "on") ? "" : "->showDetail(false)";
63
+            $editShow = ($field['column_edit'] == "on") ? "" : "->showEdit(false)";
64
+            $addShow = ($field['column_add'] == "on") ? "" : "->showAdd(false)";
65 65
             $optionTable = $field['column_option_table'];
66 66
             $optionValue = $field['column_option_value'];
67 67
             $optionDisplay = $field['column_option_display'];
68 68
             $optionSqlCondition = $field['column_option_sql_condition'];
69
-            $optionSqlCondition = str_replace('"',"'", $optionSqlCondition);
69
+            $optionSqlCondition = str_replace('"', "'", $optionSqlCondition);
70 70
             $sqlRawQuery = $field['column_sql_query'];
71 71
             $options = $field['column_options'];
72 72
 
73 73
             $methodName = Str::studly($field['column_type']);
74
-            if($label && $column) {
75
-                if(in_array($field['column_type'],['radio','select_option','checkbox'])) {
76
-                    if($options) {
74
+            if ($label && $column) {
75
+                if (in_array($field['column_type'], ['radio', 'select_option', 'checkbox'])) {
76
+                    if ($options) {
77 77
                         $optResult = [];
78
-                        foreach($options as $opt) {
78
+                        foreach ($options as $opt) {
79 79
                             $optResult[$opt['key']] = $opt['label'];
80 80
                         }
81
-                        $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '")->options('.min_var_export($optResult).')' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t";
81
+                        $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'")->options('.min_var_export($optResult).')'.$required.$indexShow.$detailShow.$addShow.$editShow.$help.';'."\n\t\t";
82 82
                     }
83
-                }elseif (in_array($field['column_type'],['radio_table','select_table'])) {
83
+                }elseif (in_array($field['column_type'], ['radio_table', 'select_table'])) {
84 84
                     if ($optionTable && $optionValue && $optionDisplay) {
85
-                        $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '",["table"=>"' . $optionTable . '","value_option"=>"' . $optionValue . '","display_option"=>"' . $optionDisplay . '","sql_condition"=>"' . $optionSqlCondition . '"])' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t";
85
+                        $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'",["table"=>"'.$optionTable.'","value_option"=>"'.$optionValue.'","display_option"=>"'.$optionDisplay.'","sql_condition"=>"'.$optionSqlCondition.'"])'.$required.$indexShow.$detailShow.$addShow.$editShow.$help.';'."\n\t\t";
86 86
                     }
87 87
                 }elseif ($field['column_type'] == "select_query") {
88
-                    if($sqlRawQuery && Str::contains($sqlRawQuery,["as `key`","as `label`"])) {
89
-                        $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '","'.$sqlRawQuery.'")' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t";
88
+                    if ($sqlRawQuery && Str::contains($sqlRawQuery, ["as `key`", "as `label`"])) {
89
+                        $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'","'.$sqlRawQuery.'")'.$required.$indexShow.$detailShow.$addShow.$editShow.$help.';'."\n\t\t";
90 90
                     }
91
-                }else{
91
+                } else {
92 92
                     $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'")'.$required.$indexShow.$detailShow.$addShow.$editShow.$help.';'."\n\t\t";
93 93
                 }
94 94
             }
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
         $module['controller'] = $filename;
112 112
         $module['last_column_build'] = json_encode($this->columns);
113 113
 
114
-        if($moduleData = DB::table("cb_modules")->where("name", $name)->where("table_name",$this->table)->first()) {
115
-            DB::table("cb_modules")->where("id",$moduleData->id)->update($module);
114
+        if ($moduleData = DB::table("cb_modules")->where("name", $name)->where("table_name", $this->table)->first()) {
115
+            DB::table("cb_modules")->where("id", $moduleData->id)->update($module);
116 116
             $id_modules = $moduleData->id;
117
-        }else{
117
+        } else {
118 118
             $id_modules = DB::table('cb_modules')->insertGetId($module);
119 119
         }
120 120
 
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
         $menu['name'] = $module['name'];
124 124
         $menu['type'] = 'module';
125 125
         $menu['cb_modules_id'] = $id_modules;
126
-        if(isset($moduleData)) {
127
-            DB::table("cb_menus")->where("cb_modules_id",$moduleData->id)->update($menu);
128
-        }else{
126
+        if (isset($moduleData)) {
127
+            DB::table("cb_menus")->where("cb_modules_id", $moduleData->id)->update($menu);
128
+        } else {
129 129
             DB::table('cb_menus')->insertGetId($menu);
130 130
         }
131 131
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
                         }
81 81
                         $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '")->options('.min_var_export($optResult).')' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t";
82 82
                     }
83
-                }elseif (in_array($field['column_type'],['radio_table','select_table'])) {
83
+                } elseif (in_array($field['column_type'],['radio_table','select_table'])) {
84 84
                     if ($optionTable && $optionValue && $optionDisplay) {
85 85
                         $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '",["table"=>"' . $optionTable . '","value_option"=>"' . $optionValue . '","display_option"=>"' . $optionDisplay . '","sql_condition"=>"' . $optionSqlCondition . '"])' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t";
86 86
                     }
87
-                }elseif ($field['column_type'] == "select_query") {
87
+                } elseif ($field['column_type'] == "select_query") {
88 88
                     if($sqlRawQuery && Str::contains($sqlRawQuery,["as `key`","as `label`"])) {
89 89
                         $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '","'.$sqlRawQuery.'")' . $required . $indexShow . $detailShow . $addShow . $editShow . $help . ';' . "\n\t\t";
90 90
                     }
91
-                }else{
91
+                } else{
92 92
                     $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'")'.$required.$indexShow.$detailShow.$addShow.$editShow.$help.';'."\n\t\t";
93 93
                 }
94 94
             }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         if($moduleData = DB::table("cb_modules")->where("name", $name)->where("table_name",$this->table)->first()) {
115 115
             DB::table("cb_modules")->where("id",$moduleData->id)->update($module);
116 116
             $id_modules = $moduleData->id;
117
-        }else{
117
+        } else{
118 118
             $id_modules = DB::table('cb_modules')->insertGetId($module);
119 119
         }
120 120
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         $menu['cb_modules_id'] = $id_modules;
126 126
         if(isset($moduleData)) {
127 127
             DB::table("cb_menus")->where("cb_modules_id",$moduleData->id)->update($menu);
128
-        }else{
128
+        } else{
129 129
             DB::table('cb_menus')->insertGetId($menu);
130 130
         }
131 131
 
Please login to merge, or discard this patch.
src/helpers/CB.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 {
19 19
 
20 20
     public function getRoleByName($roleName) {
21
-        return $this->find("cb_roles",['name'=>$roleName]);
21
+        return $this->find("cb_roles", ['name'=>$roleName]);
22 22
     }
23 23
 
24 24
     public function fcm() {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     }
35 35
 
36 36
     public function getDeveloperUrl($path = null) {
37
-        $path = ($path)?"/".trim($path,"/"):null;
37
+        $path = ($path) ? "/".trim($path, "/") : null;
38 38
         return url("developer/".getSetting("developer_path")).$path;
39 39
     }
40 40
 
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
     public function getAdminUrl($path = null) {
54
-        $path = ($path)?"/".trim($path,"/"):null;
54
+        $path = ($path) ? "/".trim($path, "/") : null;
55 55
         return url(cbConfig("ADMIN_PATH")).$path;
56 56
     }
57 57
 
58 58
     public function getAppName() {
59
-        return env("APP_NAME","CRUDBOOSTER");
59
+        return env("APP_NAME", "CRUDBOOSTER");
60 60
     }
61 61
 
62 62
     /**
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $fileData = base64_decode($value);
69 69
         $mime_type = finfo_buffer(finfo_open(), $fileData, FILEINFO_MIME_TYPE);
70
-        if($mime_type) {
71
-            if($mime_type = explode('/', $mime_type)) {
70
+        if ($mime_type) {
71
+            if ($mime_type = explode('/', $mime_type)) {
72 72
                 $ext = $mime_type[1];
73
-                if($ext) {
73
+                if ($ext) {
74 74
                     $filePath = 'uploads/'.date('Y-m');
75 75
                     Storage::makeDirectory($filePath);
76 76
                     $filename = sha1(strRandom(5)).'.'.$ext;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
             $file = request()->file($name);
100 100
             $ext = strtolower($file->getClientOriginalExtension());
101
-            if(in_array($ext,cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
101
+            if (in_array($ext, cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
102 102
                 $filename = slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME));
103 103
                 $file_path = 'uploads/'.date('Y-m');
104 104
 
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
                 }
113 113
 
114 114
                 if (Storage::putFileAs($file_path, $file, $filename)) {
115
-                    if($resize_width || $resize_height) {
115
+                    if ($resize_width || $resize_height) {
116 116
                         $this->resizeImage($file_path.'/'.$filename, $resize_width, $resize_height);
117 117
                     }
118 118
                     return $file_path.'/'.$filename;
119 119
                 } else {
120 120
                     throw new \Exception("Something went wrong, file can't upload!");
121 121
                 }
122
-            }else{
122
+            } else {
123 123
                 throw new \Exception("The file format is not allowed!");
124 124
             }
125 125
 
@@ -142,22 +142,22 @@  discard block
 block discarded – undo
142 142
                 $img = Image::make(storage_path('app/'.$file_path.'/'.$filename));
143 143
                 $img->fit($resize_width, $resize_height);
144 144
                 $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty);
145
-            } elseif ($resize_width && ! $resize_height) {
145
+            } elseif ($resize_width && !$resize_height) {
146 146
                 $img = Image::make(storage_path('app/'.$file_path.'/'.$filename));
147
-                $img->resize($resize_width, null, function ($constraint) {
147
+                $img->resize($resize_width, null, function($constraint) {
148 148
                     $constraint->aspectRatio();
149 149
                 });
150 150
                 $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty);
151
-            } elseif (! $resize_width && $resize_height) {
151
+            } elseif (!$resize_width && $resize_height) {
152 152
                 $img = Image::make(storage_path('app/'.$file_path.'/'.$filename));
153
-                $img->resize(null, $resize_height, function ($constraint) {
153
+                $img->resize(null, $resize_height, function($constraint) {
154 154
                     $constraint->aspectRatio();
155 155
                 });
156 156
                 $img->save(storage_path('app/'.$file_path.'/'.$filename), $qty);
157 157
             } else {
158 158
                 $img = Image::make(storage_path('app/'.$file_path.'/'.$filename));
159 159
                 if ($img->width() > 1300) {
160
-                    $img->resize(1300, null, function ($constraint) {
160
+                    $img->resize(1300, null, function($constraint) {
161 161
                         $constraint->aspectRatio();
162 162
                     });
163 163
                 }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         $validator = Validator::make($input_arr, $rules, $messages);
275 275
         if ($validator->fails()) {
276 276
             $message = $validator->errors()->all();
277
-            throw new CBValidationException(implode("; ",$message));
277
+            throw new CBValidationException(implode("; ", $message));
278 278
         }
279 279
     }
280 280
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     public function findPrimaryKey($table)
287 287
     {
288 288
         $pk = DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey();
289
-        if(!$pk) {
289
+        if (!$pk) {
290 290
             return null;
291 291
         }
292 292
         return $pk->getColumns()[0];
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             $string_parameters_array = explode('&', $string_parameters);
336 336
             foreach ($string_parameters_array as $s) {
337 337
                 $part = explode('=', $s);
338
-                if(isset($part[0]) && isset($part[1])) {
338
+                if (isset($part[0]) && isset($part[1])) {
339 339
                     $name = htmlspecialchars(urldecode($part[0]));
340 340
                     $name = strip_tags($name);
341 341
                     $value = htmlspecialchars(urldecode($part[1]));
@@ -352,16 +352,16 @@  discard block
 block discarded – undo
352 352
 
353 353
 
354 354
     public function routeGet($prefix, $controller) {
355
-        $alias = str_replace("@"," ", $controller);
355
+        $alias = str_replace("@", " ", $controller);
356 356
         $alias = ucwords($alias);
357
-        $alias = str_replace(" ","",$alias);
357
+        $alias = str_replace(" ", "", $alias);
358 358
         Route::get($prefix, ['uses' => $controller, 'as' => $alias]);
359 359
     }
360 360
 
361 361
     public function routePost($prefix, $controller) {
362
-        $alias = str_replace("@"," ", $controller);
362
+        $alias = str_replace("@", " ", $controller);
363 363
         $alias = ucwords($alias);
364
-        $alias = str_replace(" ","",$alias);
364
+        $alias = str_replace(" ", "", $alias);
365 365
         Route::post($prefix, ['uses' => $controller, 'as' => $alias]);
366 366
     }
367 367
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
         $prefix = trim($prefix, '/').'/';
388 388
 
389
-        if(substr($controller,0,1) != "\\") {
389
+        if (substr($controller, 0, 1) != "\\") {
390 390
             $controller = "\App\Http\Controllers\\".$controller;
391 391
         }
392 392
 
Please login to merge, or discard this patch.
src/helpers/Helper.php 2 patches
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@  discard block
 block discarded – undo
9 9
 |
10 10
 */
11 11
 
12
-if(!function_exists('rglob')) {
12
+if (!function_exists('rglob')) {
13 13
     function rglob($pattern, $flags = 0) {
14 14
         $files = glob($pattern, $flags);
15
-        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
15
+        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
16 16
             $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags));
17 17
         }
18 18
         return $files;
19 19
     }
20 20
 }
21 21
 
22
-if(!function_exists('convertPHPToMomentFormat')) {
22
+if (!function_exists('convertPHPToMomentFormat')) {
23 23
     function convertPHPToMomentFormat($format)
24 24
     {
25 25
         $replacements = [
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
     }
67 67
 }
68 68
 
69
-if(!function_exists('slug')) {
69
+if (!function_exists('slug')) {
70 70
     function slug($string, $separator = '-') {
71 71
         return \Illuminate\Support\Str::slug($string, $separator);
72 72
     }
73 73
 }
74 74
 
75
-if(!function_exists('columnSingleton')) {
75
+if (!function_exists('columnSingleton')) {
76 76
     /**
77 77
      * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton
78 78
      */
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     }
82 82
 }
83 83
 
84
-if(!function_exists('cbHook'))
84
+if (!function_exists('cbHook'))
85 85
 {
86 86
     /**
87 87
      * @return crocodicstudio\crudbooster\hooks\CBHook
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     }
94 94
 }
95 95
 
96
-if(!function_exists('getTypeHook'))
96
+if (!function_exists('getTypeHook'))
97 97
 {
98 98
     /**
99 99
      * @param string $type
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     }
107 107
 }
108 108
 
109
-if(!function_exists('getPrimaryKey'))
109
+if (!function_exists('getPrimaryKey'))
110 110
 {
111 111
     function getPrimaryKey($table_name)
112 112
     {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     }
115 115
 }
116 116
 
117
-if(!function_exists('cb'))
117
+if (!function_exists('cb'))
118 118
 {
119 119
     function cb()
120 120
     {
@@ -122,25 +122,25 @@  discard block
 block discarded – undo
122 122
     }
123 123
 }
124 124
 
125
-if(!function_exists('cbAsset')) {
125
+if (!function_exists('cbAsset')) {
126 126
     function cbAsset($path) {
127 127
         return asset("cb_asset/".$path);
128 128
     }
129 129
 }
130 130
 
131
-if(!function_exists("cbConfig")) {
131
+if (!function_exists("cbConfig")) {
132 132
     function cbConfig($name) {
133 133
         return config("crudbooster.".$name);
134 134
     }
135 135
 }
136 136
 
137
-if(!function_exists("strRandom")) {
137
+if (!function_exists("strRandom")) {
138 138
     function strRandom($length = 5) {
139 139
         return \Illuminate\Support\Str::random($length);
140 140
     }
141 141
 }
142 142
 
143
-if(!function_exists('module')) {
143
+if (!function_exists('module')) {
144 144
     function module()
145 145
     {
146 146
         $module = new \crocodicstudio\crudbooster\helpers\Module();
@@ -148,43 +148,43 @@  discard block
 block discarded – undo
148 148
     }
149 149
 }
150 150
 
151
-if(!function_exists('getAdminLoginURL')) {
151
+if (!function_exists('getAdminLoginURL')) {
152 152
     function getAdminLoginURL()
153 153
     {
154 154
         return url(config('crudbooster.ADMIN_LOGIN_PATH'));
155 155
     }
156 156
 }
157 157
 
158
-if(!function_exists('dummyPhoto')) {
158
+if (!function_exists('dummyPhoto')) {
159 159
     function dummyPhoto()
160 160
     {
161 161
         return config('crudbooster.DUMMY_PHOTO');
162 162
     }
163 163
 }
164 164
 
165
-if(!function_exists('assetThumbnail')) {
165
+if (!function_exists('assetThumbnail')) {
166 166
 	function assetThumbnail($path) {
167
-		$path = str_replace('uploads/','uploads_thumbnail/',$path);
167
+		$path = str_replace('uploads/', 'uploads_thumbnail/', $path);
168 168
 		return asset($path);
169 169
 	}
170 170
 }
171 171
 
172
-if(!function_exists('assetResize')) {
173
-	function assetResize($path,$width,$height=null,$quality=70) {
172
+if (!function_exists('assetResize')) {
173
+	function assetResize($path, $width, $height = null, $quality = 70) {
174 174
 		$basename = basename($path);
175 175
 	    $pathWithoutName = str_replace($basename, '', $path);
176 176
 	    $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename;
177
-	    if(Storage::exists($newLocation)) {
177
+	    if (Storage::exists($newLocation)) {
178 178
 	        return asset($newLocation);
179
-	    }else{
180
-	        $img = Image::make(storage_path($path))->fit($width,$height);
181
-	        $img->save(storage_path($newLocation),$quality);
179
+	    } else {
180
+	        $img = Image::make(storage_path($path))->fit($width, $height);
181
+	        $img->save(storage_path($newLocation), $quality);
182 182
 	        return asset($newLocation);
183 183
 	    }
184 184
 	}
185 185
 }
186 186
 
187
-if(!function_exists('extract_unit')) {	
187
+if (!function_exists('extract_unit')) {	
188 188
 	/*
189 189
 	Credits: Bit Repository
190 190
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 }
203 203
 
204 204
 
205
-if(!function_exists('now')) {
205
+if (!function_exists('now')) {
206 206
 	function now() {		
207 207
 		return date('Y-m-d H:i:s');
208 208
 	}
@@ -216,14 +216,14 @@  discard block
 block discarded – undo
216 216
 |
217 217
 */
218 218
 
219
-if(!function_exists('putSetting')) {
219
+if (!function_exists('putSetting')) {
220 220
     function putSetting($key, $value)
221 221
     {
222
-        if(file_exists(storage_path('.cbconfig'))) {
222
+        if (file_exists(storage_path('.cbconfig'))) {
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
 
@@ -235,26 +235,26 @@  discard block
 block discarded – undo
235 235
     }
236 236
 }
237 237
 
238
-if(!function_exists('getSetting')) {
238
+if (!function_exists('getSetting')) {
239 239
     function getSetting($key, $default = null)
240 240
     {
241
-        if(file_exists(storage_path('.cbconfig'))) {
241
+        if (file_exists(storage_path('.cbconfig'))) {
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
-        if(isset($settings[$key])) {
250
-            return $settings[$key]?:$default;
251
-        }else{
249
+        if (isset($settings[$key])) {
250
+            return $settings[$key] ?: $default;
251
+        } else {
252 252
             return $default;
253 253
         }
254 254
     }
255 255
 }
256 256
 
257
-if(!function_exists('timeAgo')) {
257
+if (!function_exists('timeAgo')) {
258 258
     function timeAgo($datetime_to, $datetime_from = null, $full = false)
259 259
     {
260 260
         $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             }
286 286
         }
287 287
 
288
-        if (! $full) {
288
+        if (!$full) {
289 289
             $string = array_slice($string, 0, 1);
290 290
         }
291 291
 
@@ -293,22 +293,22 @@  discard block
 block discarded – undo
293 293
     }
294 294
 }
295 295
 
296
-if(!function_exists("array_map_r")) {
297
-    function array_map_r( $func, $arr )
296
+if (!function_exists("array_map_r")) {
297
+    function array_map_r($func, $arr)
298 298
     {
299 299
         $newArr = array();
300 300
 
301
-        foreach( $arr as $key => $value )
301
+        foreach ($arr as $key => $value)
302 302
         {
303 303
             $key = $func($key);
304
-            $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) );
304
+            $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value)));
305 305
         }
306 306
 
307 307
         return $newArr;
308 308
     }
309 309
 }
310 310
 
311
-if(!function_exists("sanitizeXSS"))
311
+if (!function_exists("sanitizeXSS"))
312 312
 {
313 313
     function sanitizeXSS($value)
314 314
     {
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     }
321 321
 }
322 322
 
323
-if(!function_exists("requestAll")) {
323
+if (!function_exists("requestAll")) {
324 324
     function requestAll() {
325 325
         $all = array_map_r("sanitizeXSS", request()->all());
326 326
         return $all;
@@ -329,22 +329,22 @@  discard block
 block discarded – undo
329 329
 
330 330
 
331 331
 
332
-if(!function_exists('getURLFormat')) {
332
+if (!function_exists('getURLFormat')) {
333 333
     function getURLFormat($name) {
334 334
         $url = request($name);
335
-        if(filter_var($url, FILTER_VALIDATE_URL)) {
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
     }
341 341
 }
342 342
 
343
-if(!function_exists('g')) {
343
+if (!function_exists('g')) {
344 344
     function g($name, $safe = true) {
345
-        if($safe == true) {
345
+        if ($safe == true) {
346 346
             $response = request($name);
347
-            if(is_string($response)) {
347
+            if (is_string($response)) {
348 348
                 $response = sanitizeXSS($response);
349 349
             }elseif (is_array($response)) {
350 350
                 array_walk_recursive($response, function(&$response) {
@@ -353,25 +353,25 @@  discard block
 block discarded – undo
353 353
             }
354 354
 
355 355
             return $response;
356
-        }else{
356
+        } else {
357 357
             return Request::get($name);
358 358
         }
359 359
     }
360 360
 }
361 361
 
362
-if(!function_exists('min_var_export')) {
362
+if (!function_exists('min_var_export')) {
363 363
     function min_var_export($input) {
364
-        if(is_array($input)) {
364
+        if (is_array($input)) {
365 365
             $buffer = [];
366
-            foreach($input as $key => $value)
366
+            foreach ($input as $key => $value)
367 367
                 $buffer[] = var_export($key, true)."=>".min_var_export($value);
368
-            return "[".implode(",",$buffer)."]";
368
+            return "[".implode(",", $buffer)."]";
369 369
         } else
370 370
             return var_export($input, true);
371 371
     }
372 372
 }
373 373
 
374
-if(!function_exists('rrmdir')) {
374
+if (!function_exists('rrmdir')) {
375 375
 	/*
376 376
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
377 377
 	*/
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.