Passed
Push — master ( 81fba8...eadbd6 )
by Ferry
06:56 queued 03:37
created
src/configs/crudbooster.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@
 block discarded – undo
30 30
     /*
31 31
      * For security reason we have limit the upload file formats bellow
32 32
      */
33
-    'UPLOAD_FILE_EXTENSION_ALLOWED' => ['jpg','jpeg','png','gif','pdf','xls','xlsx','doc','docx','txt','zip','rar','rtf'],
33
+    'UPLOAD_FILE_EXTENSION_ALLOWED' => ['jpg', 'jpeg', 'png', 'gif', 'pdf', 'xls', 'xlsx', 'doc', 'docx', 'txt', 'zip', 'rar', 'rtf'],
34 34
 
35
-    'UPLOAD_IMAGE_EXTENSION_ALLOWED' => ['jpg','jpeg','png','gif'],
35
+    'UPLOAD_IMAGE_EXTENSION_ALLOWED' => ['jpg', 'jpeg', 'png', 'gif'],
36 36
 
37 37
     /*
38 38
      * Google FCM Server Key is used to send a notification via FireBase cloud message
Please login to merge, or discard this patch.
src/controllers/FileController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $fullStoragePath = storage_path('app/'.$fullFilePath);
35 35
         $lifetime = 31556926; // One year in seconds
36 36
 
37
-        if (! Storage::exists($fullFilePath)) {
37
+        if (!Storage::exists($fullFilePath)) {
38 38
             abort(404);
39 39
         }
40 40
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
                 $h = Request::get('h') ?: $w;
56 56
             }
57 57
 
58
-            $imgRaw = Image::cache(function ($image) use ($fullStoragePath, $w, $h) {
58
+            $imgRaw = Image::cache(function($image) use ($fullStoragePath, $w, $h) {
59 59
                 $im = $image->make($fullStoragePath);
60 60
                 if ($w) {
61
-                    if (! $h) {
61
+                    if (!$h) {
62 62
                         $im->fit($w);
63 63
                     } else {
64 64
                         $im->fit($w, $h);
Please login to merge, or discard this patch.
src/helpers/Helper.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -118,49 +118,49 @@  discard block
 block discarded – undo
118 118
 }
119 119
 
120 120
 if(!function_exists('assetThumbnail')) {
121
-	function assetThumbnail($path) {
122
-		$path = str_replace('uploads/','uploads_thumbnail/',$path);
123
-		return asset($path);
124
-	}
121
+    function assetThumbnail($path) {
122
+        $path = str_replace('uploads/','uploads_thumbnail/',$path);
123
+        return asset($path);
124
+    }
125 125
 }
126 126
 
127 127
 if(!function_exists('assetResize')) {
128
-	function assetResize($path,$width,$height=null,$quality=70) {
129
-		$basename = basename($path);
130
-	    $pathWithoutName = str_replace($basename, '', $path);
131
-	    $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename;
132
-	    if(Storage::exists($newLocation)) {
133
-	        return asset($newLocation);
134
-	    }else{
135
-	        $img = Image::make(storage_path($path))->fit($width,$height);
136
-	        $img->save(storage_path($newLocation),$quality);
137
-	        return asset($newLocation);
138
-	    }
139
-	}
128
+    function assetResize($path,$width,$height=null,$quality=70) {
129
+        $basename = basename($path);
130
+        $pathWithoutName = str_replace($basename, '', $path);
131
+        $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename;
132
+        if(Storage::exists($newLocation)) {
133
+            return asset($newLocation);
134
+        }else{
135
+            $img = Image::make(storage_path($path))->fit($width,$height);
136
+            $img->save(storage_path($newLocation),$quality);
137
+            return asset($newLocation);
138
+        }
139
+    }
140 140
 }
141 141
 
142 142
 if(!function_exists('extract_unit')) {	
143
-	/*
143
+    /*
144 144
 	Credits: Bit Repository
145 145
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
146 146
 	*/
147
-	function extract_unit($string, $start, $end)
148
-	{
149
-	$pos = stripos($string, $start);
150
-	$str = substr($string, $pos);
151
-	$str_two = substr($str, strlen($start));
152
-	$second_pos = stripos($str_two, $end);
153
-	$str_three = substr($str_two, 0, $second_pos);
154
-	$unit = trim($str_three); // remove whitespaces
155
-	return $unit;
156
-	}
147
+    function extract_unit($string, $start, $end)
148
+    {
149
+    $pos = stripos($string, $start);
150
+    $str = substr($string, $pos);
151
+    $str_two = substr($str, strlen($start));
152
+    $second_pos = stripos($str_two, $end);
153
+    $str_three = substr($str_two, 0, $second_pos);
154
+    $unit = trim($str_three); // remove whitespaces
155
+    return $unit;
156
+    }
157 157
 }
158 158
 
159 159
 
160 160
 if(!function_exists('now')) {
161
-	function now() {		
162
-		return date('Y-m-d H:i:s');
163
-	}
161
+    function now() {		
162
+        return date('Y-m-d H:i:s');
163
+    }
164 164
 }
165 165
 
166 166
 /* 
@@ -324,22 +324,22 @@  discard block
 block discarded – undo
324 324
 }
325 325
 
326 326
 if(!function_exists('rrmdir')) {
327
-	/*
327
+    /*
328 328
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
329 329
 	*/
330
-	function rrmdir($dir) { 
331
-	   if (is_dir($dir)) { 
332
-	     $objects = scandir($dir); 
333
-	     foreach ($objects as $object) { 
334
-	       if ($object != "." && $object != "..") { 
335
-	         if (is_dir($dir."/".$object))
336
-	           rrmdir($dir."/".$object);
337
-	         else
338
-	           unlink($dir."/".$object); 
339
-	       } 
340
-	     }
341
-	     rmdir($dir); 
342
-	   } 
343
-	 }
330
+    function rrmdir($dir) { 
331
+        if (is_dir($dir)) { 
332
+            $objects = scandir($dir); 
333
+            foreach ($objects as $object) { 
334
+            if ($object != "." && $object != "..") { 
335
+                if (is_dir($dir."/".$object))
336
+                rrmdir($dir."/".$object);
337
+                else
338
+                unlink($dir."/".$object); 
339
+            } 
340
+            }
341
+            rmdir($dir); 
342
+        } 
343
+        }
344 344
 }
345 345
 
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 |
10 10
 */
11 11
 
12
-if(!function_exists('convertPHPToMomentFormat')) {
12
+if (!function_exists('convertPHPToMomentFormat')) {
13 13
     function convertPHPToMomentFormat($format)
14 14
     {
15 15
         $replacements = [
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
     }
57 57
 }
58 58
 
59
-if(!function_exists('slug')) {
59
+if (!function_exists('slug')) {
60 60
     function slug($string, $separator = '-') {
61 61
         return \Illuminate\Support\Str::slug($string, $separator);
62 62
     }
63 63
 }
64 64
 
65
-if(!function_exists('columnSingleton')) {
65
+if (!function_exists('columnSingleton')) {
66 66
     /**
67 67
      * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton
68 68
      */
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     }
72 72
 }
73 73
 
74
-if(!function_exists('cbHook'))
74
+if (!function_exists('cbHook'))
75 75
 {
76 76
     /**
77 77
      * @return crocodicstudio\crudbooster\hooks\CBHook
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     }
84 84
 }
85 85
 
86
-if(!function_exists('getTypeHook'))
86
+if (!function_exists('getTypeHook'))
87 87
 {
88 88
     /**
89 89
      * @param string $type
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     }
97 97
 }
98 98
 
99
-if(!function_exists('getPrimaryKey'))
99
+if (!function_exists('getPrimaryKey'))
100 100
 {
101 101
     function getPrimaryKey($table_name)
102 102
     {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     }
105 105
 }
106 106
 
107
-if(!function_exists('cb'))
107
+if (!function_exists('cb'))
108 108
 {
109 109
     function cb()
110 110
     {
@@ -112,25 +112,25 @@  discard block
 block discarded – undo
112 112
     }
113 113
 }
114 114
 
115
-if(!function_exists('cbAsset')) {
115
+if (!function_exists('cbAsset')) {
116 116
     function cbAsset($path) {
117 117
         return asset("cb_asset/".$path);
118 118
     }
119 119
 }
120 120
 
121
-if(!function_exists("cbConfig")) {
121
+if (!function_exists("cbConfig")) {
122 122
     function cbConfig($name) {
123 123
         return config("crudbooster.".$name);
124 124
     }
125 125
 }
126 126
 
127
-if(!function_exists("strRandom")) {
127
+if (!function_exists("strRandom")) {
128 128
     function strRandom($length = 5) {
129 129
         return \Illuminate\Support\Str::random($length);
130 130
     }
131 131
 }
132 132
 
133
-if(!function_exists('module')) {
133
+if (!function_exists('module')) {
134 134
     function module()
135 135
     {
136 136
         $module = new \crocodicstudio\crudbooster\helpers\Module();
@@ -138,43 +138,43 @@  discard block
 block discarded – undo
138 138
     }
139 139
 }
140 140
 
141
-if(!function_exists('getAdminLoginURL')) {
141
+if (!function_exists('getAdminLoginURL')) {
142 142
     function getAdminLoginURL()
143 143
     {
144 144
         return url(config('crudbooster.ADMIN_LOGIN_PATH'));
145 145
     }
146 146
 }
147 147
 
148
-if(!function_exists('dummyPhoto')) {
148
+if (!function_exists('dummyPhoto')) {
149 149
     function dummyPhoto()
150 150
     {
151 151
         return config('crudbooster.DUMMY_PHOTO');
152 152
     }
153 153
 }
154 154
 
155
-if(!function_exists('assetThumbnail')) {
155
+if (!function_exists('assetThumbnail')) {
156 156
 	function assetThumbnail($path) {
157
-		$path = str_replace('uploads/','uploads_thumbnail/',$path);
157
+		$path = str_replace('uploads/', 'uploads_thumbnail/', $path);
158 158
 		return asset($path);
159 159
 	}
160 160
 }
161 161
 
162
-if(!function_exists('assetResize')) {
163
-	function assetResize($path,$width,$height=null,$quality=70) {
162
+if (!function_exists('assetResize')) {
163
+	function assetResize($path, $width, $height = null, $quality = 70) {
164 164
 		$basename = basename($path);
165 165
 	    $pathWithoutName = str_replace($basename, '', $path);
166 166
 	    $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename;
167
-	    if(Storage::exists($newLocation)) {
167
+	    if (Storage::exists($newLocation)) {
168 168
 	        return asset($newLocation);
169
-	    }else{
170
-	        $img = Image::make(storage_path($path))->fit($width,$height);
171
-	        $img->save(storage_path($newLocation),$quality);
169
+	    } else {
170
+	        $img = Image::make(storage_path($path))->fit($width, $height);
171
+	        $img->save(storage_path($newLocation), $quality);
172 172
 	        return asset($newLocation);
173 173
 	    }
174 174
 	}
175 175
 }
176 176
 
177
-if(!function_exists('extract_unit')) {	
177
+if (!function_exists('extract_unit')) {	
178 178
 	/*
179 179
 	Credits: Bit Repository
180 180
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 }
193 193
 
194 194
 
195
-if(!function_exists('now')) {
195
+if (!function_exists('now')) {
196 196
 	function now() {		
197 197
 		return date('Y-m-d H:i:s');
198 198
 	}
@@ -206,13 +206,13 @@  discard block
 block discarded – undo
206 206
 |
207 207
 */
208 208
 
209
-if(!function_exists('putSetting')) {
209
+if (!function_exists('putSetting')) {
210 210
     function putSetting($key, $value)
211 211
     {
212
-        if(file_exists(storage_path('.cbconfig'))) {
212
+        if (file_exists(storage_path('.cbconfig'))) {
213 213
             $settings = file_get_contents(storage_path('.cbconfig'));
214 214
             $settings = unserialize($settings);
215
-        }else{
215
+        } else {
216 216
             $settings = [];
217 217
         }
218 218
 
@@ -223,25 +223,25 @@  discard block
 block discarded – undo
223 223
     }
224 224
 }
225 225
 
226
-if(!function_exists('getSetting')) {
226
+if (!function_exists('getSetting')) {
227 227
     function getSetting($key, $default = null)
228 228
     {
229
-        if(file_exists(storage_path('.cbconfig'))) {
229
+        if (file_exists(storage_path('.cbconfig'))) {
230 230
             $settings = file_get_contents(storage_path('.cbconfig'));
231 231
             $settings = unserialize($settings);
232
-        }else{
232
+        } else {
233 233
             $settings = [];
234 234
         }
235 235
 
236
-        if(isset($settings[$key])) {
237
-            return $settings[$key]?:$default;
238
-        }else{
236
+        if (isset($settings[$key])) {
237
+            return $settings[$key] ?: $default;
238
+        } else {
239 239
             return $default;
240 240
         }
241 241
     }
242 242
 }
243 243
 
244
-if(!function_exists('timeAgo')) {
244
+if (!function_exists('timeAgo')) {
245 245
     function timeAgo($datetime_to, $datetime_from = null, $full = false)
246 246
     {
247 247
         $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             }
273 273
         }
274 274
 
275
-        if (! $full) {
275
+        if (!$full) {
276 276
             $string = array_slice($string, 0, 1);
277 277
         }
278 278
 
@@ -280,22 +280,22 @@  discard block
 block discarded – undo
280 280
     }
281 281
 }
282 282
 
283
-if(!function_exists("array_map_r")) {
284
-    function array_map_r( $func, $arr )
283
+if (!function_exists("array_map_r")) {
284
+    function array_map_r($func, $arr)
285 285
     {
286 286
         $newArr = array();
287 287
 
288
-        foreach( $arr as $key => $value )
288
+        foreach ($arr as $key => $value)
289 289
         {
290 290
             $key = $func($key);
291
-            $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) );
291
+            $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value)));
292 292
         }
293 293
 
294 294
         return $newArr;
295 295
     }
296 296
 }
297 297
 
298
-if(!function_exists("sanitizeXSS"))
298
+if (!function_exists("sanitizeXSS"))
299 299
 {
300 300
     function sanitizeXSS($value)
301 301
     {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
     }
308 308
 }
309 309
 
310
-if(!function_exists("requestAll")) {
310
+if (!function_exists("requestAll")) {
311 311
     function requestAll() {
312 312
         $all = array_map_r("sanitizeXSS", request()->all());
313 313
         return $all;
@@ -316,22 +316,22 @@  discard block
 block discarded – undo
316 316
 
317 317
 
318 318
 
319
-if(!function_exists('getURLFormat')) {
319
+if (!function_exists('getURLFormat')) {
320 320
     function getURLFormat($name) {
321 321
         $url = request($name);
322
-        if(filter_var($url, FILTER_VALIDATE_URL)) {
322
+        if (filter_var($url, FILTER_VALIDATE_URL)) {
323 323
             return $url;
324
-        }else{
324
+        } else {
325 325
             return request()->url();
326 326
         }
327 327
     }
328 328
 }
329 329
 
330
-if(!function_exists('g')) {
330
+if (!function_exists('g')) {
331 331
     function g($name, $safe = true) {
332
-        if($safe == true) {
332
+        if ($safe == true) {
333 333
             $response = request($name);
334
-            if(is_string($response)) {
334
+            if (is_string($response)) {
335 335
                 $response = sanitizeXSS($response);
336 336
             }elseif (is_array($response)) {
337 337
                 array_walk_recursive($response, function(&$response) {
@@ -340,25 +340,25 @@  discard block
 block discarded – undo
340 340
             }
341 341
 
342 342
             return $response;
343
-        }else{
343
+        } else {
344 344
             return Request::get($name);
345 345
         }
346 346
     }
347 347
 }
348 348
 
349
-if(!function_exists('min_var_export')) {
349
+if (!function_exists('min_var_export')) {
350 350
     function min_var_export($input) {
351
-        if(is_array($input)) {
351
+        if (is_array($input)) {
352 352
             $buffer = [];
353
-            foreach($input as $key => $value)
353
+            foreach ($input as $key => $value)
354 354
                 $buffer[] = var_export($key, true)."=>".min_var_export($value);
355
-            return "[".implode(",",$buffer)."]";
355
+            return "[".implode(",", $buffer)."]";
356 356
         } else
357 357
             return var_export($input, true);
358 358
     }
359 359
 }
360 360
 
361
-if(!function_exists('rrmdir')) {
361
+if (!function_exists('rrmdir')) {
362 362
 	/*
363 363
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
364 364
 	*/
Please login to merge, or discard this patch.
src/helpers/MailHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
     }
42 42
 
43 43
     public function send() {
44
-        Mail::send("crudbooster::emails.blank", ['content' => $this->content], function ($message) {
44
+        Mail::send("crudbooster::emails.blank", ['content' => $this->content], function($message) {
45 45
             $message->priority(1);
46 46
             $message->to($this->to_email);
47 47
             $message->from($this->sender_email, $this->sender_name);
Please login to merge, or discard this patch.
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/types/checkbox/Hook.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public function assignment($value, $column)
22 22
     {
23
-        return implode(";", request( $column->getName() ));
23
+        return implode(";", request($column->getName()));
24 24
     }
25 25
 
26 26
 }
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
src/types/checkbox/CheckboxHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 class CheckboxHelper
12 12
 {
13 13
     public static function parseValuesToArray($values) {
14
-        $data = explode(";",$values);
14
+        $data = explode(";", $values);
15 15
         return $data;
16 16
     }
17 17
     
Please login to merge, or discard this patch.
src/validations/validation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php 
2 2
 
3
-\Validator::extend('alpha_spaces', function ($attribute, $value) {
3
+\Validator::extend('alpha_spaces', function($attribute, $value) {
4 4
     // This will only accept alpha and spaces. 
5 5
     // If you want to accept hyphens use: /^[\pL\s-]+$/u.
6 6
     return preg_match('/^[\pL\s]+$/u', $value); 
7 7
 },'The :attribute should be letters and spaces only');
8 8
 
9
-\Validator::extend('alpha_num_spaces', function ($attribute, $value) {
9
+\Validator::extend('alpha_num_spaces', function($attribute, $value) {
10 10
     // This will only accept alphanumeric and spaces. 
11 11
     return preg_match('/^[a-zA-Z0-9\s]+$/', $value); 
12 12
 },'The :attribute should be alphanumeric characters and spaces only');
13 13
\ No newline at end of file
Please login to merge, or discard this patch.
src/middlewares/CBDeveloper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
18 18
     public function handle($request, Closure $next)
19 19
     {
20 20
 
21
-        if(!session()->has("developer")) {
22
-            return cb()->redirect(cb()->getDeveloperUrl("login"),"Please login for first");
21
+        if (!session()->has("developer")) {
22
+            return cb()->redirect(cb()->getDeveloperUrl("login"), "Please login for first");
23 23
         }
24 24
 
25 25
         return $next($request);
Please login to merge, or discard this patch.