Passed
Push — master ( c50061...e7f23e )
by Ferry
06:42 queued 02:00
created
src/types/select_query/SelectQuery.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 
32 32
         if(is_callable($query)) {
33 33
             $result = call_user_func($query);
34
-        }else{
34
+        } else{
35 35
             $result = DB::select(DB::raw($query));
36 36
         }
37 37
 
Please login to merge, or discard this patch.
src/controllers/DeveloperModulesController.php 1 patch
Braces   +11 added lines, -9 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
 
@@ -83,7 +83,9 @@  discard block
 block discarded – undo
83 83
             if($column != $pk) {
84 84
 
85 85
                 // Skip Column
86
-                if($column == 'deleted_at') continue;
86
+                if($column == 'deleted_at') {
87
+                    continue;
88
+                }
87 89
 
88 90
                 // Check if any relation table candidate
89 91
                 $optionTable = "";
@@ -92,7 +94,7 @@  discard block
 block discarded – undo
92 94
                     if(Schema::hasTable($relationTable)) {
93 95
                         $optionTable = $relationTable;
94 96
                     }
95
-                }elseif (Str::substr(strtolower($column),0,3) == "id_") {
97
+                } elseif (Str::substr(strtolower($column),0,3) == "id_") {
96 98
                     $relationTable = Str::substr($column,3);
97 99
                     if(Schema::hasTable($relationTable)) {
98 100
                         $optionTable = $relationTable;
@@ -105,15 +107,15 @@  discard block
 block discarded – undo
105 107
 
106 108
                 if(Str::contains(strtolower($label),["photo","image","picture","gambar"])) {
107 109
                     $type = "image";
108
-                }elseif (Str::contains(strtolower($label),["email","mail"])) {
110
+                } elseif (Str::contains(strtolower($label),["email","mail"])) {
109 111
                     $type = "email";
110
-                }elseif (Str::contains(strtolower($label),["description","content","detail"])) {
112
+                } elseif (Str::contains(strtolower($label),["description","content","detail"])) {
111 113
                     $type =  "wysiwyg";
112
-                }elseif (Str::contains(strtolower($label),["price","money","grand_total","tax"])) {
114
+                } elseif (Str::contains(strtolower($label),["price","money","grand_total","tax"])) {
113 115
                     $type = "money";
114
-                }elseif (Str::contains(strtolower($label),["quantity","qty","total","phone","telp"])) {
116
+                } elseif (Str::contains(strtolower($label),["quantity","qty","total","phone","telp"])) {
115 117
                     $type = "number";
116
-                }elseif (Str::contains(strtolower($label),["date"])) {
118
+                } elseif (Str::contains(strtolower($label),["date"])) {
117 119
                     $type = "date";
118 120
                 }
119 121
 
@@ -219,7 +221,7 @@  discard block
 block discarded – undo
219 221
 
220 222
                     if($item['length']) {
221 223
                         $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."', ".$item['length'].")$nullable;\n\t\t\t";
222
-                    }else{
224
+                    } else{
223 225
                         $structureItems .= "\$table->".$item['type_data']."('".$item['field_name']."')$nullable;\n\t\t\t";
224 226
                     }
225 227
                 }
Please login to merge, or discard this patch.
src/helpers/ModuleGenerator.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
                         }
113 113
                         $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '")->options('.min_var_export($optResult).')' . $additional . ';' . "\n\t\t";
114 114
                     }
115
-                }elseif (in_array($field['column_type'],['radio_table','select_table'])) {
115
+                } elseif (in_array($field['column_type'],['radio_table','select_table'])) {
116 116
                     if ($optionTable && $optionValue && $optionDisplay) {
117 117
                         $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '",["table"=>"' . $optionTable . '","value_option"=>"' . $optionValue . '","display_option"=>"' . $optionDisplay . '","sql_condition"=>"' . $optionSqlCondition . '"])' . $additional . ';' . "\n\t\t";
118 118
                     }
119
-                }elseif ($field['column_type'] == "select_query") {
119
+                } elseif ($field['column_type'] == "select_query") {
120 120
                     if($sqlRawQuery && Str::contains($sqlRawQuery,["as `key`","as `label`"])) {
121 121
                         $scaffold .= '$this->add' . $methodName . '("' . $label . '","' . $column . '","'.$sqlRawQuery.'")' . $additional . ';' . "\n\t\t";
122 122
                     }
123
-                }else{
123
+                } else{
124 124
                     $scaffold .= '$this->add'.$methodName.'("'.$label.'","'.$column.'")'.$additional.';'."\n\t\t";
125 125
                 }
126 126
             }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         if($moduleData = DB::table("cb_modules")->where("name", $name)->where("table_name",$this->table)->first()) {
147 147
             DB::table("cb_modules")->where("id",$moduleData->id)->update($module);
148 148
             $id_modules = $moduleData->id;
149
-        }else{
149
+        } else{
150 150
             $id_modules = DB::table('cb_modules')->insertGetId($module);
151 151
         }
152 152
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         $menu['cb_modules_id'] = $id_modules;
158 158
         if(isset($moduleData)) {
159 159
             DB::table("cb_menus")->where("cb_modules_id",$moduleData->id)->update($menu);
160
-        }else{
160
+        } else{
161 161
             DB::table('cb_menus')->insertGetId($menu);
162 162
         }
163 163
 
Please login to merge, or discard this patch.
src/helpers/CB.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
             if($resize_width || $resize_height) {
93 93
                 $this->resizeImage($file, $file_path.'/'.$filename, $resize_width, $resize_height);
94 94
                 return $file_path.'/'.$filename;
95
-            }else{
95
+            } else{
96 96
                 if (Storage::put($file_path.'/'.$filename, $file, 'public')) {
97 97
                     return $file_path.'/'.$filename;
98 98
                 } else {
99 99
                     throw new \Exception("Something went wrong, file can't upload!");
100 100
                 }
101 101
             }
102
-        }else{
102
+        } else{
103 103
             throw new \Exception("The file format is not allowed!");
104 104
         }
105 105
     }
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
                 if($filename && $ext) {
122 122
                     return $this->uploadFileProcess($filename, $ext, $fileData, $encrypt, $resize_width, $resize_height);
123 123
                 }
124
-            }else {
124
+            } else {
125 125
                 throw new \Exception("Mime type not found");
126 126
             }
127
-        }else{
127
+        } else{
128 128
             throw new \Exception("Mime type not found");
129 129
         }
130 130
     }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             }
202 202
 
203 203
             Storage::put($fullFilePath, $img, 'public');
204
-        }else{
204
+        } else{
205 205
             throw new \Exception("The file format is not allowed!");
206 206
         }
207 207
     }
Please login to merge, or discard this patch.
src/controllers/CBController.php 1 patch
Braces   +27 added lines, -13 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
             $key = $parameters[0];
32 32
             if(isset($this->data[$key])) {
33 33
                 return $this->data[$key];
34
-            }else{
34
+            } else{
35 35
                 return null;
36 36
             }
37
-        }else{
37
+        } else{
38 38
             return null;
39 39
         }
40 40
     }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                     if(Schema::hasColumn($this->data['table'], $column->getField())) {
72 72
                         $query->addSelect($this->data['table'].'.'.$column->getField());
73 73
                     }
74
-                }else{
74
+                } else{
75 75
                     $query->addSelect($column->getField());
76 76
                 }
77 77
             }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         {
84 84
             if(isset($this->data['hook_search_query'])) {
85 85
                 $query = call_user_func($this->data['hook_search_query'], $query);
86
-            }else{
86
+            } else{
87 87
                 $query->where(function ($where) use ($columns) {
88 88
                     /**
89 89
                      * @var $where Builder
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                     {
93 93
                         if(strpos($column->getField(),".") === false) {
94 94
                             $field = $this->data['table'].'.'.$column->getField();
95
-                        }else{
95
+                        } else{
96 96
                             $field = $column->getField();
97 97
                         }
98 98
                         $where->orWhere($field, 'like', '%'.request('q').'%');
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             if(in_array(request('order_by'),columnSingleton()->getColumnNameOnly())) {
112 112
                 $query->orderBy(request('order_by'), request('order_sort'));
113 113
             }
114
-        }else{
114
+        } else{
115 115
             $query->orderBy($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), "desc");
116 116
         }
117 117
 
@@ -120,7 +120,9 @@  discard block
 block discarded – undo
120 120
 
121 121
     public function getIndex()
122 122
     {
123
-        if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
123
+        if(!module()->canBrowse()) {
124
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
125
+        }
124 126
 
125 127
         $query = $this->repository();
126 128
         $result = $query->paginate( request("limit")?:cbConfig("LIMIT_TABLE_DATA") );
@@ -147,7 +149,9 @@  discard block
 block discarded – undo
147 149
 
148 150
     public function getAdd()
149 151
     {
150
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
152
+        if(!module()->canCreate()) {
153
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
154
+        }
151 155
 
152 156
         $data = [];
153 157
         $data['page_title'] = $this->data['page_title'].' : '.cbLang('add');
@@ -157,7 +161,9 @@  discard block
 block discarded – undo
157 161
 
158 162
     public function postAddSave()
159 163
     {
160
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
164
+        if(!module()->canCreate()) {
165
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
166
+        }
161 167
 
162 168
         try {
163 169
             $this->validation();
@@ -202,7 +208,9 @@  discard block
 block discarded – undo
202 208
 
203 209
     public function getEdit($id)
204 210
     {
205
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
211
+        if(!module()->canUpdate()) {
212
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
213
+        }
206 214
 
207 215
         $data = [];
208 216
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
@@ -213,7 +221,9 @@  discard block
 block discarded – undo
213 221
 
214 222
     public function postEditSave($id)
215 223
     {
216
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
224
+        if(!module()->canUpdate()) {
225
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
226
+        }
217 227
 
218 228
         try {
219 229
             $this->validation();
@@ -257,7 +267,9 @@  discard block
 block discarded – undo
257 267
 
258 268
     public function getDelete($id)
259 269
     {
260
-        if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
270
+        if(!module()->canDelete()) {
271
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
272
+        }
261 273
 
262 274
         if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
263 275
             call_user_func($this->data['hook_before_delete'], $id);
@@ -284,7 +296,9 @@  discard block
 block discarded – undo
284 296
 
285 297
     public function getDetail($id)
286 298
     {
287
-        if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
299
+        if(!module()->canRead()) {
300
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
301
+        }
288 302
 
289 303
         $data = [];
290 304
         $data['row'] = $this->repository()->where($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), $id)->first();
Please login to merge, or discard this patch.
src/commands/DeveloperCommandService.php 1 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 1 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/AdminProfileController.php 1 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 1 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.