Passed
Push — master ( 3a35a0...56f21d )
by Iman
04:00
created
src/helpers/cb_helpers.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -8,28 +8,28 @@  discard block
 block discarded – undo
8 8
 | ---------------------------------------------------------------------------------------------------------------
9 9
 |
10 10
 */
11
-if (! function_exists('cbModulesNS')) {
11
+if (!function_exists('cbModulesNS')) {
12 12
     function cbModulesNS($path = '')
13 13
     {
14 14
         return \crocodicstudio\crudbooster\helpers\CbStructure::cbModulesNS($path);
15 15
     }
16 16
 }
17 17
 
18
-if (! function_exists('cbAdminPath')) {
18
+if (!function_exists('cbAdminPath')) {
19 19
     function cbAdminPath()
20 20
     {
21 21
         return cbConfig('ADMIN_PATH');
22 22
     }
23 23
 }
24 24
 
25
-if (! function_exists('ctrlNamespace')) {
25
+if (!function_exists('ctrlNamespace')) {
26 26
     function ctrlNamespace()
27 27
     {
28 28
         return \crocodicstudio\crudbooster\helpers\CbStructure::ctrlNamespace();
29 29
     }
30 30
 }
31 31
 
32
-if (! function_exists('is_checked')) {
32
+if (!function_exists('is_checked')) {
33 33
     /**
34 34
      * @param $format
35 35
      * @param $value
@@ -53,35 +53,35 @@  discard block
 block discarded – undo
53 53
     }
54 54
 }
55 55
 
56
-if (! function_exists('CbComponentsPath')) {
56
+if (!function_exists('CbComponentsPath')) {
57 57
     function CbComponentsPath($type = '')
58 58
     {
59 59
         return \crocodicstudio\crudbooster\helpers\CbStructure::componentsPath($type);
60 60
     }
61 61
 }
62 62
 
63
-if (! function_exists('CbPublishedComponentsPath')) {
63
+if (!function_exists('CbPublishedComponentsPath')) {
64 64
     function CbPublishedComponentsPath($type = '')
65 65
     {
66 66
         return \crocodicstudio\crudbooster\helpers\CbStructure::publishedComponentsPath($type);
67 67
     }
68 68
 }
69 69
 
70
-if (! function_exists('controllers_dir')) {
70
+if (!function_exists('controllers_dir')) {
71 71
     function controllers_dir()
72 72
     {
73 73
         return \crocodicstudio\crudbooster\helpers\CbStructure::controllersDir();
74 74
     }
75 75
 }
76 76
 
77
-if (! function_exists('controller_path')) {
77
+if (!function_exists('controller_path')) {
78 78
     function controller_path($controller)
79 79
     {
80 80
         return \crocodicstudio\crudbooster\helpers\CbStructure::controllerPath($controller);
81 81
     }
82 82
 }
83 83
 
84
-if (! function_exists('extract_unit')) {
84
+if (!function_exists('extract_unit')) {
85 85
     /*
86 86
     Credits: Bit Repository
87 87
     URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     }
100 100
 }
101 101
 
102
-if (! function_exists('now')) {
102
+if (!function_exists('now')) {
103 103
     function now()
104 104
     {
105 105
         return date('Y-m-d H:i:s');
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
 | $name = name of input
114 114
 |
115 115
 */
116
-if (! function_exists('g')) {
116
+if (!function_exists('g')) {
117 117
     function g($name)
118 118
     {
119 119
         return Request::get($name);
120 120
     }
121 121
 }
122 122
 
123
-if (! function_exists('cbTrans')) {
123
+if (!function_exists('cbTrans')) {
124 124
     /**
125 125
      * Translate the given message.
126 126
      *
@@ -134,34 +134,34 @@  discard block
 block discarded – undo
134 134
     }
135 135
 }
136 136
 
137
-if (! function_exists('cbAsset')) {
137
+if (!function_exists('cbAsset')) {
138 138
     function cbAsset($key)
139 139
     {
140 140
         return asset('vendor/crudbooster/assets/'.$key);
141 141
     }
142 142
 }
143 143
 
144
-if (! function_exists('cbScript')) {
144
+if (!function_exists('cbScript')) {
145 145
     function cbScript($key)
146 146
     {
147 147
         return '<script src="'.cbAsset($key).'" type="text/javascript"></script>';
148 148
     }
149 149
 }
150 150
 
151
-if (! function_exists('cbStyleSheet')) {
151
+if (!function_exists('cbStyleSheet')) {
152 152
     function cbStyleSheet($key)
153 153
     {
154 154
         return '<link rel="stylesheet" type="text/css" href="'.cbAsset($key).'"/>';
155 155
     }
156 156
 }
157 157
 
158
-if (! function_exists('cbConfig')) {
158
+if (!function_exists('cbConfig')) {
159 159
     function cbConfig($key, $default = null)
160 160
     {
161 161
         return config('crudbooster.'.$key, $default);
162 162
     }
163 163
 }
164
-if (! function_exists('makeValidationForHTML')) {
164
+if (!function_exists('makeValidationForHTML')) {
165 165
     function makeValidationForHTML($rules)
166 166
     {
167 167
         $validation = [];
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     }
180 180
 }
181 181
 
182
-if (! function_exists('findSelected')) {
182
+if (!function_exists('findSelected')) {
183 183
     /**
184 184
      * @param $rawvalue
185 185
      * @param $form
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      */
189 189
     function findSelected($rawvalue, $form, $optionValue)
190 190
     {
191
-        if (! $rawvalue) {
191
+        if (!$rawvalue) {
192 192
             return '';
193 193
         }
194 194
         $value = $rawvalue;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         return $selected;
211 211
     }
212 212
 }
213
-if (! function_exists('array_get_keys')) {
213
+if (!function_exists('array_get_keys')) {
214 214
 
215 215
     /**
216 216
      * @param array $_array
@@ -226,28 +226,28 @@  discard block
 block discarded – undo
226 226
     }
227 227
 }
228 228
 
229
-if (! function_exists('cbGetSetting')) {
229
+if (!function_exists('cbGetSetting')) {
230 230
     function cbGetSetting($name)
231 231
     {
232 232
         return \crocodicstudio\crudbooster\Modules\SettingModule\SettingRepo::getSetting($name);
233 233
     }
234 234
 }
235 235
 
236
-if (! function_exists('backWithMsg')) {
236
+if (!function_exists('backWithMsg')) {
237 237
     function backWithMsg($msg, $type = 'success')
238 238
     {
239 239
         sendAndTerminate(redirect()->back()->with(['message_type' => $type, 'message' => $msg]));
240 240
     }
241 241
 }
242 242
 
243
-if (! function_exists('underField')) {
243
+if (!function_exists('underField')) {
244 244
     function underField($help, $error)
245 245
     {
246
-        $error = $error ? "<i class='fa fa-info-circle'></i> $error":'' ;
246
+        $error = $error ? "<i class='fa fa-info-circle'></i> $error" : '';
247 247
         return "<div class='text-danger'>$error</div><p class='help-block'>$help</p>";
248 248
     }
249 249
 }
250
-if (! function_exists('cbIcon')) {
250
+if (!function_exists('cbIcon')) {
251 251
     function cbIcon($icon)
252 252
     {
253 253
         return '<i class=\'fa fa-'.$icon.'\'></i>';
Please login to merge, or discard this patch.
src/Modules/ModuleGenerator/Step3Handler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 {
10 10
     public function showForm($id)
11 11
     {
12
-        $row = ModulesRepo::find($id);;
12
+        $row = ModulesRepo::find($id); ;
13 13
 
14 14
         $columns = \Schema::getColumnListing($row->table_name);
15 15
 
Please login to merge, or discard this patch.
src/Modules/ModuleGenerator/ControllerGenerator/FormConfigGenerator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
             $props = array_get($map, FieldDetector::detect($colName), null);
90 90
             unset($map);
91
-            if($props !== null){
91
+            if ($props !== null) {
92 92
                 $input = array_merge($input, $props);
93 93
             }
94 94
 
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
         $arr = array_get([
130 130
             'string' => $default,
131 131
             'text' => ['textarea', "string|min:5", []],
132
-            'date' => ['date', "date", ['php_format' => 'M, d Y', 'datepicker_format' => 'M, dd YYYY',]],
133
-            'datetime' => ['datetime', "date_format:Y-m-d H:i:s", ['php_format' => 'M, d Y H:i',]],
132
+            'date' => ['date', "date", ['php_format' => 'M, d Y', 'datepicker_format' => 'M, dd YYYY', ]],
133
+            'datetime' => ['datetime', "date_format:Y-m-d H:i:s", ['php_format' => 'M, d Y H:i', ]],
134 134
             'time' => ['time', 'date_format:H:i:s', []],
135 135
             'double' => ['money', "integer|min:0", []],
136 136
             'int' => ['number', 'integer|min:0', []],
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     private static function handleForeignKey($field)
151 151
     {
152 152
         $jointable = str_replace(['id_', '_id'], '', $field);
153
-        if (! Schema::hasTable($jointable)) {
153
+        if (!Schema::hasTable($jointable)) {
154 154
             return ['', ''];
155 155
         }
156 156
         $options = [
Please login to merge, or discard this patch.
src/helpers/CRUDBooster.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     public static function first($table, $id)
110 110
     {
111 111
         $table = self::parseSqlTable($table)['table'];
112
-        if (! is_array($id)) {
112
+        if (!is_array($id)) {
113 113
             $pk = DbInspector::findPK($table);
114 114
 
115 115
             return DB::table($table)->where($pk, $id)->first();
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         $controllerName = basename($controllerName);
136 136
         $route_url = route($controllerName.'GetIndex');
137 137
 
138
-        if (! $path) {
138
+        if (!$path) {
139 139
             return trim($route_url, '/');
140 140
         }
141 141
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     {
166 166
         $tables = DbInspector::listTables();
167 167
 
168
-        $filter = function ($tableName) {
168
+        $filter = function($tableName) {
169 169
 
170 170
             if ($tableName == config('database.migrations')) {
171 171
                 return false;
Please login to merge, or discard this patch.
src/CBCoreModule/Index/FilterIndexRows.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $filterColumn = $this->filterFalsyValues($filterColumn);
37 37
 
38
-        $result->where(function ($query) use ($filterColumn) {
38
+        $result->where(function($query) use ($filterColumn) {
39 39
             foreach ($filterColumn as $key => $fc) {
40 40
 
41 41
                 $value = @$fc['value'];
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                     case 'in':
59 59
                     case 'not in':
60 60
                         $value = explode(',', $value);
61
-                        if (! empty($value)) {
61
+                        if (!empty($value)) {
62 62
                             $query->whereIn($key, $value);
63 63
                         }
64 64
                         break;
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
      */
103 103
     private function filterFalsyValues($filterColumn)
104 104
     {
105
-        return array_filter($filterColumn, function ($fc) {
105
+        return array_filter($filterColumn, function($fc) {
106 106
             $value = @$fc['value'];
107 107
             $type = @$fc['type'];
108 108
 
109
-            if (($type == 'between') || ! $value || ! $type) {
109
+            if (($type == 'between') || !$value || !$type) {
110 110
                 return false;
111 111
             }
112 112
 
Please login to merge, or discard this patch.
src/Modules/ModuleGenerator/AdminModulesController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     {
16 16
         $this->table = 'cms_moduls';
17 17
         $this->primaryKey = 'id';
18
-        $this->title_field = 'name' ;
18
+        $this->title_field = 'name';
19 19
         $this->limit = 100;
20 20
         $this->button_add = false;
21 21
         $this->buttonExport = false;
Please login to merge, or discard this patch.
src/Modules/ApiGeneratorModule/AdminColumnsTableController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 
30 30
         $result = \Schema::getColumnListing($table);
31 31
 
32
-        $result = array_filter($result, function ($row) {
33
-            return ! (in_array($row, ['created_at', 'deleted_at', 'updated_at']));
32
+        $result = array_filter($result, function($row) {
33
+            return !(in_array($row, ['created_at', 'deleted_at', 'updated_at']));
34 34
         });
35 35
 
36 36
         $newResult = [];
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             $type_field = \Schema::getColumnType($table, $row);
39 39
             $newResult[] = ['name' => $row, 'type' => $this->getFieldType($row, $type_field)];
40 40
 
41
-            if (! in_array($type, ['list', 'detail']) || ! starts_with($row, 'id_')) {
41
+            if (!in_array($type, ['list', 'detail']) || !starts_with($row, 'id_')) {
42 42
                 continue;
43 43
             }
44 44
 
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
         }
85 85
         $table2 = substr($ro, 3);
86 86
         $columns = DB::getSchemaBuilder()->getColumnListing($table2);
87
-        $columns = array_filter($columns, function ($col) {
88
-            return ! FieldDetector::isExceptional($col);
87
+        $columns = array_filter($columns, function($col) {
88
+            return !FieldDetector::isExceptional($col);
89 89
         });
90 90
 
91 91
         foreach ($columns as $col) {
Please login to merge, or discard this patch.
src/CBCoreModule/FileUploader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 {
11 11
     function uploadFile($name)
12 12
     {
13
-        if (! Request::hasFile($name)) {
13
+        if (!Request::hasFile($name)) {
14 14
             return null;
15 15
         }
16 16
         $file = Request::file($name);
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     private function validateExtension($ext)
35 35
     {
36
-        if (! FieldDetector::isUploadField($ext)) {
36
+        if (!FieldDetector::isUploadField($ext)) {
37 37
             echo "The filetype is not allowed!";
38 38
             exit;
39 39
         }
Please login to merge, or discard this patch.
src/controllers/ApiController/ExecuteApi.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             }
69 69
             $this->show($result, $posts);
70 70
         } elseif (in_array($actionType, ['save_add', 'save_edit'])) {
71
-            $rowAssign = array_filter($input_validator, function ($column) use ($table) {
71
+            $rowAssign = array_filter($input_validator, function($column) use ($table) {
72 72
                 return Schema::hasColumn($table, $column);
73 73
             }, ARRAY_FILTER_USE_KEY);
74 74
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      */
156 156
     private function filterRows($data, $parameters, $posts, $table, $typeExcept)
157 157
     {
158
-        $data->where(function ($w) use ($parameters, $posts, $table, $typeExcept) {
158
+        $data->where(function($w) use ($parameters, $posts, $table, $typeExcept) {
159 159
             foreach ($parameters as $param) {
160 160
                 $name = $param['name'];
161 161
                 $type = $param['type'];
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                 $rows->$k = asset($v);
286 286
             }
287 287
 
288
-            if (! in_array($k, $responsesFields)) {
288
+            if (!in_array($k, $responsesFields)) {
289 289
                 unset($rows->$k);
290 290
             }
291 291
         }
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
     {
340 340
         $result = $this->makeResult(1, 'success');
341 341
 
342
-        return array_merge($result, (array)$rows);
342
+        return array_merge($result, (array) $rows);
343 343
     }
344 344
 
345 345
     /**
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
      */
350 350
     private function applyLike($data, $search_in, $value)
351 351
     {
352
-        $data->where(function ($w) use ($search_in, $value) {
352
+        $data->where(function($w) use ($search_in, $value) {
353 353
             foreach ($search_in as $k => $field) {
354 354
                 $method = 'orWhere';
355 355
                 if ($k == 0) {
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
      */
371 371
     private function joinRelatedTables($table, $responsesFields, $name, $data, $nameTmp)
372 372
     {
373
-        if (! DbInspector::isForeignKey($name)) {
373
+        if (!DbInspector::isForeignKey($name)) {
374 374
             return $nameTmp;
375 375
         }
376 376
         $joinTable = DbInspector::getTableForeignKey($name);
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     {
408 408
         $this->ctrl->hookValidate();
409 409
 
410
-        if (! $this->ctrl->validate) {
410
+        if (!$this->ctrl->validate) {
411 411
             return true;
412 412
         }  // hook have to return true
413 413
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
     private function doValidation($inputValidator, $dataValidation, $posts)
440 440
     {
441 441
         $validator = Validator::make($inputValidator, $dataValidation);
442
-        if (! $validator->fails()) {
442
+        if (!$validator->fails()) {
443 443
             return true;
444 444
         }
445 445
         $message = $validator->errors()->all();
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
     {
461 461
         $row = $data->first();
462 462
 
463
-        if (! $row) {
463
+        if (!$row) {
464 464
             return $this->makeResult(0, 'There is no data found !');
465 465
         }
466 466
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
                 $this->passwordError($posts);
483 483
             }
484 484
 
485
-            if (! $required && $used && $value) {
485
+            if (!$required && $used && $value) {
486 486
                 $this->passwordError($posts);
487 487
             }
488 488
         }
@@ -498,11 +498,11 @@  discard block
 block discarded – undo
498 498
      */
499 499
     private function filterRedundantResp($responses)
500 500
     {
501
-        $responses = array_filter($responses, function ($resp) {
502
-            return ! ($resp['name'] == 'ref_id' || $resp['type'] == 'custom');
501
+        $responses = array_filter($responses, function($resp) {
502
+            return !($resp['name'] == 'ref_id' || $resp['type'] == 'custom');
503 503
         });
504 504
 
505
-        $responses = array_filter($responses, function ($resp) {
505
+        $responses = array_filter($responses, function($resp) {
506 506
             return (intval($resp['used']) != 0 || DbInspector::isForeignKey($resp['name']));
507 507
         });
508 508
 
@@ -517,15 +517,15 @@  discard block
 block discarded – undo
517 517
     private function validateParams($parameters, $table)
518 518
     {
519 519
         $posts = request()->all();
520
-        if (! $parameters) {
520
+        if (!$parameters) {
521 521
             return ['', ''];
522 522
         }
523 523
         $typeExcept = ['password', 'ref', 'base64_file', 'custom', 'search'];
524 524
         $inputValidator = [];
525 525
         $dataValidation = [];
526 526
 
527
-        $parameters = array_filter($parameters, function ($param){
528
-            return !(is_string($param['config'])&& !starts_with($param['config'], '*'));
527
+        $parameters = array_filter($parameters, function($param) {
528
+            return !(is_string($param['config']) && !starts_with($param['config'], '*'));
529 529
         });
530 530
 
531 531
         foreach ($parameters as $param) {
Please login to merge, or discard this patch.