Passed
Push — master ( 272bf9...2dee83 )
by Ferry
03:38
created
src/controllers/CBController.php 1 patch
Braces   +23 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function getIndex()
34 34
     {
35
-        if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
35
+        if(!module()->canBrowse()) {
36
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
37
+        }
36 38
 
37 39
         $query = $this->repository();
38 40
         $result = $query->paginate( request("limit")?:$this->data['limit'] );
@@ -43,7 +45,9 @@  discard block
 block discarded – undo
43 45
 
44 46
     public function getAdd()
45 47
     {
46
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
48
+        if(!module()->canCreate()) {
49
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
50
+        }
47 51
 
48 52
         $data = [];
49 53
         $data['page_title'] = $this->data['page_title'].' : '.cbLang('add');
@@ -53,7 +57,9 @@  discard block
 block discarded – undo
53 57
 
54 58
     public function postAddSave()
55 59
     {
56
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
60
+        if(!module()->canCreate()) {
61
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
62
+        }
57 63
 
58 64
         try {
59 65
             $this->validation();
@@ -102,7 +108,9 @@  discard block
 block discarded – undo
102 108
 
103 109
     public function getEdit($id)
104 110
     {
105
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
111
+        if(!module()->canUpdate()) {
112
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
113
+        }
106 114
 
107 115
         $data = [];
108 116
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
@@ -113,7 +121,9 @@  discard block
 block discarded – undo
113 121
 
114 122
     public function postEditSave($id)
115 123
     {
116
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
124
+        if(!module()->canUpdate()) {
125
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
126
+        }
117 127
 
118 128
         try {
119 129
             $this->validation();
@@ -162,7 +172,9 @@  discard block
 block discarded – undo
162 172
 
163 173
     public function getDelete($id)
164 174
     {
165
-        if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
175
+        if(!module()->canDelete()) {
176
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
177
+        }
166 178
 
167 179
         if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
168 180
             call_user_func($this->data['hook_before_delete'], $id);
@@ -189,7 +201,9 @@  discard block
 block discarded – undo
189 201
 
190 202
     public function getDetail($id)
191 203
     {
192
-        if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
204
+        if(!module()->canRead()) {
205
+            return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
206
+        }
193 207
 
194 208
         $data = [];
195 209
         $data['row'] = $this->repository()->where($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), $id)->first();
@@ -212,10 +226,10 @@  discard block
 block discarded – undo
212 226
             $key = $parameters[0];
213 227
             if(isset($this->data[$key])) {
214 228
                 return $this->data[$key];
215
-            }else{
229
+            } else{
216 230
                 return null;
217 231
             }
218
-        }else{
232
+        } else{
219 233
             return null;
220 234
         }
221 235
     }
Please login to merge, or discard this patch.
src/routes.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
     if (Request::is(cb()->getAdminPath())) {
68 68
         if($dashboard = getSetting("dashboard_controller")) {
69 69
             cb()->routeGet("/", $dashboard."@getIndex");
70
-        }else{
70
+        } else{
71 71
             cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex");
72 72
         }
73 73
     }
Please login to merge, or discard this patch.
src/controllers/DeveloperPluginStoreController.php 1 patch
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
                 rrmdir(app_path("CBPlugins/".$key));
104 104
 
105 105
                 return response()->json(['status'=>true, 'message'=>'Plugin has been uninstalled!']);
106
-            }else{
106
+            } else{
107 107
                 return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin is not found']);
108 108
             }
109
-        }else {
109
+        } else {
110 110
             return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin key is not found']);
111 111
         }
112 112
     }
@@ -118,8 +118,7 @@  discard block
 block discarded – undo
118 118
             if (( $file != '.' ) && ( $file != '..' )) {
119 119
                 if ( is_dir($src . '/' . $file) ) {
120 120
                     $this->recursiveCopy($src . '/' . $file,$dst . '/' . $file);
121
-                }
122
-                else {
121
+                } else {
123 122
                     copy($src . '/' . $file,$dst . '/' . $file);
124 123
                 }
125 124
             }
@@ -165,7 +164,9 @@  discard block
 block discarded – undo
165 164
                         fclose($temp);
166 165
 
167 166
                         // Rename
168
-                        if(file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
167
+                        if(file_exists(app_path("CBPlugins/".$key))) {
168
+                            rrmdir(app_path("CBPlugins/".$key));
169
+                        }
169 170
                         rename(app_path("CBPlugins/".$dirName), app_path("CBPlugins/".$key));
170 171
 
171 172
                         // Read Plugin JSON
@@ -192,7 +193,7 @@  discard block
 block discarded – undo
192 193
                     }
193 194
                 }
194 195
 
195
-            }else{
196
+            } else{
196 197
                 return response()->json(['status'=>false,'message'=>'Failed to install/update, plugin key is not found']);
197 198
             }
198 199
         } catch (\Exception $e) {
Please login to merge, or discard this patch.
src/controllers/DeveloperMenusController.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
             $menu['type'] = request('type');
56 56
             if(request('type') == 'module') {
57 57
                 $menu['cb_modules_id'] = request('cb_modules_id');
58
-            }elseif (request('type') == 'url') {
58
+            } elseif (request('type') == 'url') {
59 59
                 $menu['path'] = request('url_value');
60
-            }elseif (request('type') == 'path') {
60
+            } elseif (request('type') == 'path') {
61 61
                 $menu['path'] = request('path_value');
62 62
             } elseif (request("type") == "empty") {
63 63
                 $menu['path'] = "javascript:void(0);";
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
             $menu['type'] = request('type');
85 85
             if(request('type') == 'module') {
86 86
                 $menu['cb_modules_id'] = request('cb_modules_id');
87
-            }elseif (request('type') == 'url') {
87
+            } elseif (request('type') == 'url') {
88 88
                 $menu['path'] = request('url_value');
89
-            }elseif (request('type') == 'path') {
89
+            } elseif (request('type') == 'path') {
90 90
                 $menu['path'] = request('path_value');
91 91
             } elseif (request("type") == "empty") {
92 92
                 $menu['path'] = "javascript:void(0);";
Please login to merge, or discard this patch.
src/helpers/Module.php 1 patch
Braces   +37 added lines, -22 removed lines patch added patch discarded remove patch
@@ -90,45 +90,60 @@  discard block
 block discarded – undo
90 90
 
91 91
     public function canBrowse() {
92 92
         if($this->privilege) {
93
-            if($this->privilege->can_browse) return true;
94
-            else return false;
95
-        }else{
93
+            if($this->privilege->can_browse) {
94
+                return true;
95
+            } else {
96
+                return false;
97
+            }
98
+        } else{
96 99
             return true;
97 100
         }
98 101
     }
99 102
 
100 103
     public function canCreate() {
101 104
         if($this->privilege) {
102
-            if($this->privilege->can_create) return true;
103
-            else return false;
104
-        }else{
105
+            if($this->privilege->can_create) {
106
+                return true;
107
+            } else {
108
+                return false;
109
+            }
110
+        } else{
105 111
             return true;
106 112
         }
107 113
     }
108 114
 
109 115
     public function canRead() {
110 116
         if($this->privilege) {
111
-            if($this->privilege->can_read) return true;
112
-            else return false;
113
-        }else{
117
+            if($this->privilege->can_read) {
118
+                return true;
119
+            } else {
120
+                return false;
121
+            }
122
+        } else{
114 123
             return true;
115 124
         }
116 125
     }
117 126
 
118 127
     public function canUpdate() {
119 128
         if($this->privilege) {
120
-            if($this->privilege->can_update) return true;
121
-            else return false;
122
-        }else{
129
+            if($this->privilege->can_update) {
130
+                return true;
131
+            } else {
132
+                return false;
133
+            }
134
+        } else{
123 135
             return true;
124 136
         }
125 137
     }
126 138
 
127 139
     public function canDelete() {
128 140
         if($this->privilege) {
129
-            if($this->privilege->can_delete) return true;
130
-            else return false;
131
-        }else{
141
+            if($this->privilege->can_delete) {
142
+                return true;
143
+            } else {
144
+                return false;
145
+            }
146
+        } else{
132 147
             return true;
133 148
         }
134 149
     }
@@ -137,7 +152,7 @@  discard block
 block discarded – undo
137 152
     {
138 153
         if($this->controller_class && method_exists($this->controller_class, 'getAdd')) {
139 154
             return action($this->controller.'@getAdd');
140
-        }else{
155
+        } else{
141 156
             return null;
142 157
         }
143 158
     }
@@ -146,7 +161,7 @@  discard block
 block discarded – undo
146 161
     {
147 162
         if($this->controller_class && method_exists($this->controller_class, 'postAddSave')) {
148 163
             return action($this->controller.'@postAddSave');
149
-        }else{
164
+        } else{
150 165
             return null;
151 166
         }
152 167
     }
@@ -155,7 +170,7 @@  discard block
 block discarded – undo
155 170
     {
156 171
         if($this->controller_class && method_exists($this->controller_class, 'getEdit')) {
157 172
             return action($this->controller.'@getEdit')."/".$id;
158
-        }else{
173
+        } else{
159 174
             return null;
160 175
         }
161 176
     }
@@ -164,7 +179,7 @@  discard block
 block discarded – undo
164 179
     {
165 180
         if(method_exists($this->controller_class, 'postEditSave')) {
166 181
             return action($this->controller.'@postEditSave')."/".$id;
167
-        }else{
182
+        } else{
168 183
             return null;
169 184
         }
170 185
     }
@@ -173,7 +188,7 @@  discard block
 block discarded – undo
173 188
     {
174 189
         if($this->controller_class && method_exists($this->controller_class, 'getDetail')) {
175 190
             return action($this->controller.'@getDetail')."/".$id;
176
-        }else{
191
+        } else{
177 192
             return null;
178 193
         }
179 194
     }
@@ -182,7 +197,7 @@  discard block
 block discarded – undo
182 197
     {
183 198
         if($this->controller_class && method_exists($this->controller_class, 'getDelete')) {
184 199
             return action($this->controller.'@getDelete')."/".$id;
185
-        }else{
200
+        } else{
186 201
             return null;
187 202
         }
188 203
     }
@@ -191,7 +206,7 @@  discard block
 block discarded – undo
191 206
     {
192 207
         if($this->controller_class && method_exists($this->controller_class, 'getIndex')) {
193 208
             return trim(action($this->controller.'@getIndex').'/'.$path,'/');
194
-        }else{
209
+        } else{
195 210
             return null;
196 211
         }
197 212
     }
Please login to merge, or discard this patch.