Passed
Push — main ( 2cb152...6ff26f )
by TARIQ
23:50
created
brighty/system/Helpers/form_helper.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 // CodeIgniter Form Helpers
16 16
 
17
-if (! function_exists('form_open')) {
17
+if (!function_exists('form_open')) {
18 18
     /**
19 19
      * Form Declaration
20 20
      *
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     function form_open(string $action = '', $attributes = [], array $hidden = []): string
28 28
     {
29 29
         // If no action is provided then set to the current url
30
-        if (! $action) {
30
+        if (!$action) {
31 31
             $action = current_url(true);
32 32
         } // If an action is not a full URL then turn it into one
33 33
         elseif (strpos($action, '://') === false) {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
60 60
         $before = Services::filters()->getFilters()['before'];
61 61
 
62
-        if ((in_array('csrf', $before, true) || array_key_exists('csrf', $before)) && strpos($action, base_url()) !== false && ! stripos($form, 'method="get"')) {
62
+        if ((in_array('csrf', $before, true) || array_key_exists('csrf', $before)) && strpos($action, base_url()) !== false && !stripos($form, 'method="get"')) {
63 63
             $form .= csrf_field($csrfId ?? null);
64 64
         }
65 65
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     }
74 74
 }
75 75
 
76
-if (! function_exists('form_open_multipart')) {
76
+if (!function_exists('form_open_multipart')) {
77 77
     /**
78 78
      * Form Declaration - Multipart type
79 79
      *
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     }
96 96
 }
97 97
 
98
-if (! function_exists('form_hidden')) {
98
+if (!function_exists('form_hidden')) {
99 99
     /**
100 100
      * Hidden Input Field
101 101
      *
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             return $form;
122 122
         }
123 123
 
124
-        if (! is_array($value)) {
124
+        if (!is_array($value)) {
125 125
             $form .= form_input($name, $value, '', 'hidden');
126 126
         } else {
127 127
             foreach ($value as $k => $v) {
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     }
135 135
 }
136 136
 
137
-if (! function_exists('form_input')) {
137
+if (!function_exists('form_input')) {
138 138
     /**
139 139
      * Text Input Field. If 'type' is passed in the $type field, it will be
140 140
      * used as the input type, for making 'email', 'phone', etc input fields.
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     }
155 155
 }
156 156
 
157
-if (! function_exists('form_password')) {
157
+if (!function_exists('form_password')) {
158 158
     /**
159 159
      * Password Field
160 160
      *
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     function form_password($data = '', string $value = '', $extra = ''): string
167 167
     {
168
-        if (! is_array($data)) {
168
+        if (!is_array($data)) {
169 169
             $data = ['name' => $data];
170 170
         }
171 171
         $data['type'] = 'password';
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     }
175 175
 }
176 176
 
177
-if (! function_exists('form_upload')) {
177
+if (!function_exists('form_upload')) {
178 178
     /**
179 179
      * Upload Field
180 180
      *
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             'name' => '',
191 191
         ];
192 192
 
193
-        if (! is_array($data)) {
193
+        if (!is_array($data)) {
194 194
             $data = ['name' => $data];
195 195
         }
196 196
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     }
201 201
 }
202 202
 
203
-if (! function_exists('form_textarea')) {
203
+if (!function_exists('form_textarea')) {
204 204
     /**
205 205
      * Textarea field
206 206
      *
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
             'cols' => '40',
215 215
             'rows' => '10',
216 216
         ];
217
-        if (! is_array($data) || ! isset($data['value'])) {
217
+        if (!is_array($data) || !isset($data['value'])) {
218 218
             $val = $value;
219 219
         } else {
220 220
             $val = $data['value'];
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     }
237 237
 }
238 238
 
239
-if (! function_exists('form_multiselect')) {
239
+if (!function_exists('form_multiselect')) {
240 240
     /**
241 241
      * Multi-select menu
242 242
      *
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     }
256 256
 }
257 257
 
258
-if (! function_exists('form_dropdown')) {
258
+if (!function_exists('form_dropdown')) {
259 259
     /**
260 260
      * Drop-down Menu
261 261
      *
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
             $defaults = ['name' => $data];
281 281
         }
282 282
 
283
-        if (! is_array($selected)) {
283
+        if (!is_array($selected)) {
284 284
             $selected = [$selected];
285 285
         }
286
-        if (! is_array($options)) {
286
+        if (!is_array($options)) {
287 287
             $options = [$options];
288 288
         }
289 289
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
     }
339 339
 }
340 340
 
341
-if (! function_exists('form_checkbox')) {
341
+if (!function_exists('form_checkbox')) {
342 342
     /**
343 343
      * Checkbox Field
344 344
      *
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
     {
350 350
         $defaults = [
351 351
             'type'  => 'checkbox',
352
-            'name'  => (! is_array($data) ? $data : ''),
352
+            'name'  => (!is_array($data) ? $data : ''),
353 353
             'value' => $value,
354 354
         ];
355 355
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
     }
373 373
 }
374 374
 
375
-if (! function_exists('form_radio')) {
375
+if (!function_exists('form_radio')) {
376 376
     /**
377 377
      * Radio Button
378 378
      *
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
      */
382 382
     function form_radio($data = '', string $value = '', bool $checked = false, $extra = ''): string
383 383
     {
384
-        if (! is_array($data)) {
384
+        if (!is_array($data)) {
385 385
             $data = ['name' => $data];
386 386
         }
387 387
         $data['type'] = 'radio';
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
     }
391 391
 }
392 392
 
393
-if (! function_exists('form_submit')) {
393
+if (!function_exists('form_submit')) {
394 394
     /**
395 395
      * Submit Button
396 396
      *
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
     }
404 404
 }
405 405
 
406
-if (! function_exists('form_reset')) {
406
+if (!function_exists('form_reset')) {
407 407
     /**
408 408
      * Reset Button
409 409
      *
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
     }
417 417
 }
418 418
 
419
-if (! function_exists('form_button')) {
419
+if (!function_exists('form_button')) {
420 420
     /**
421 421
      * Form Button
422 422
      *
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     }
442 442
 }
443 443
 
444
-if (! function_exists('form_label')) {
444
+if (!function_exists('form_label')) {
445 445
     /**
446 446
      * Form Label Tag
447 447
      *
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
     }
468 468
 }
469 469
 
470
-if (! function_exists('form_datalist')) {
470
+if (!function_exists('form_datalist')) {
471 471
     /**
472 472
      * Datalist
473 473
      *
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
     }
497 497
 }
498 498
 
499
-if (! function_exists('form_fieldset')) {
499
+if (!function_exists('form_fieldset')) {
500 500
     /**
501 501
      * Fieldset Tag
502 502
      *
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
     }
519 519
 }
520 520
 
521
-if (! function_exists('form_fieldset_close')) {
521
+if (!function_exists('form_fieldset_close')) {
522 522
     /**
523 523
      * Fieldset Close Tag
524 524
      */
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
     }
529 529
 }
530 530
 
531
-if (! function_exists('form_close')) {
531
+if (!function_exists('form_close')) {
532 532
     /**
533 533
      * Form Close Tag
534 534
      */
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
     }
539 539
 }
540 540
 
541
-if (! function_exists('set_value')) {
541
+if (!function_exists('set_value')) {
542 542
     /**
543 543
      * Form Value
544 544
      *
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
     }
567 567
 }
568 568
 
569
-if (! function_exists('set_select')) {
569
+if (!function_exists('set_select')) {
570 570
     /**
571 571
      * Set Select
572 572
      *
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
     }
604 604
 }
605 605
 
606
-if (! function_exists('set_checkbox')) {
606
+if (!function_exists('set_checkbox')) {
607 607
     /**
608 608
      * Set Checkbox
609 609
      *
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
         }
634 634
 
635 635
         // Unchecked checkbox and radio inputs are not even submitted by browsers ...
636
-        if ((string) $input === '0' || ! empty($request->getPost()) || ! empty(old($field))) {
636
+        if ((string) $input === '0' || !empty($request->getPost()) || !empty(old($field))) {
637 637
             return ($input === $value) ? ' checked="checked"' : '';
638 638
         }
639 639
 
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
     }
642 642
 }
643 643
 
644
-if (! function_exists('set_radio')) {
644
+if (!function_exists('set_radio')) {
645 645
     /**
646 646
      * Set Radio
647 647
      *
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 
672 672
         // Unchecked checkbox and radio inputs are not even submitted by browsers ...
673 673
         $result = '';
674
-        if ((string) $input === '0' || ! empty($input = $request->getPost($field)) || ! empty($input = old($field))) {
674
+        if ((string) $input === '0' || !empty($input = $request->getPost($field)) || !empty($input = old($field))) {
675 675
             $result = ($input === $value) ? ' checked="checked"' : '';
676 676
         }
677 677
 
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
     }
684 684
 }
685 685
 
686
-if (! function_exists('parse_form_attributes')) {
686
+if (!function_exists('parse_form_attributes')) {
687 687
     /**
688 688
      * Parse the form attributes
689 689
      *
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
                     unset($attributes[$key]);
702 702
                 }
703 703
             }
704
-            if (! empty($attributes)) {
704
+            if (!empty($attributes)) {
705 705
                 $default = array_merge($default, $attributes);
706 706
             }
707 707
         }
@@ -709,10 +709,10 @@  discard block
 block discarded – undo
709 709
         $att = '';
710 710
 
711 711
         foreach ($default as $key => $val) {
712
-            if (! is_bool($val)) {
712
+            if (!is_bool($val)) {
713 713
                 if ($key === 'value') {
714 714
                     $val = esc($val);
715
-                } elseif ($key === 'name' && ! strlen($default['name'])) {
715
+                } elseif ($key === 'name' && !strlen($default['name'])) {
716 716
                     continue;
717 717
                 }
718 718
                 $att .= $key . '="' . $val . '"' . ($key === array_key_last($default) ? '' : ' ');
Please login to merge, or discard this patch.
brighty/system/Helpers/html_helper.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 // CodeIgniter HTML Helpers
17 17
 
18
-if (! function_exists('ul')) {
18
+if (!function_exists('ul')) {
19 19
     /**
20 20
      * Unordered List
21 21
      *
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     }
31 31
 }
32 32
 
33
-if (! function_exists('ol')) {
33
+if (!function_exists('ol')) {
34 34
     /**
35 35
      * Ordered List
36 36
      *
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     }
45 45
 }
46 46
 
47
-if (! function_exists('_list')) {
47
+if (!function_exists('_list')) {
48 48
     /**
49 49
      * Generates the list
50 50
      *
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         foreach ($list as $key => $val) {
67 67
             $out .= str_repeat(' ', $depth + 2) . '<li>';
68 68
 
69
-            if (! is_array($val)) {
69
+            if (!is_array($val)) {
70 70
                 $out .= $val;
71 71
             } else {
72 72
                 $out .= $key
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     }
84 84
 }
85 85
 
86
-if (! function_exists('img')) {
86
+if (!function_exists('img')) {
87 87
     /**
88 88
      * Image
89 89
      *
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
      */
96 96
     function img($src = '', bool $indexPage = false, $attributes = ''): string
97 97
     {
98
-        if (! is_array($src)) {
98
+        if (!is_array($src)) {
99 99
             $src = ['src' => $src];
100 100
         }
101
-        if (! isset($src['src'])) {
101
+        if (!isset($src['src'])) {
102 102
             $src['src'] = $attributes['src'] ?? '';
103 103
         }
104
-        if (! isset($src['alt'])) {
104
+        if (!isset($src['alt'])) {
105 105
             $src['alt'] = $attributes['alt'] ?? '';
106 106
         }
107 107
 
108 108
         $img = '<img';
109 109
 
110 110
         // Check for a relative URI
111
-        if (! preg_match('#^([a-z]+:)?//#i', $src['src']) && strpos($src['src'], 'data:') !== 0) {
111
+        if (!preg_match('#^([a-z]+:)?//#i', $src['src']) && strpos($src['src'], 'data:') !== 0) {
112 112
             if ($indexPage === true) {
113 113
                 $img .= ' src="' . site_url($src['src']) . '"';
114 114
             } else {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     }
133 133
 }
134 134
 
135
-if (! function_exists('img_data')) {
135
+if (!function_exists('img_data')) {
136 136
     /**
137 137
      * Image (data)
138 138
      *
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      */
144 144
     function img_data(string $path, ?string $mime = null): string
145 145
     {
146
-        if (! is_file($path) || ! is_readable($path)) {
146
+        if (!is_file($path) || !is_readable($path)) {
147 147
             throw FileNotFoundException::forFileNotFound($path);
148 148
         }
149 149
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     }
163 163
 }
164 164
 
165
-if (! function_exists('doctype')) {
165
+if (!function_exists('doctype')) {
166 166
     /**
167 167
      * Doctype
168 168
      *
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     }
184 184
 }
185 185
 
186
-if (! function_exists('script_tag')) {
186
+if (!function_exists('script_tag')) {
187 187
     /**
188 188
      * Script
189 189
      *
@@ -195,12 +195,12 @@  discard block
 block discarded – undo
195 195
     function script_tag($src = '', bool $indexPage = false): string
196 196
     {
197 197
         $script = '<script ';
198
-        if (! is_array($src)) {
198
+        if (!is_array($src)) {
199 199
             $src = ['src' => $src];
200 200
         }
201 201
 
202 202
         foreach ($src as $k => $v) {
203
-            if ($k === 'src' && ! preg_match('#^([a-z]+:)?//#i', $v)) {
203
+            if ($k === 'src' && !preg_match('#^([a-z]+:)?//#i', $v)) {
204 204
                 if ($indexPage === true) {
205 205
                     $script .= 'src="' . site_url($v) . '" ';
206 206
                 } else {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     }
216 216
 }
217 217
 
218
-if (! function_exists('link_tag')) {
218
+if (!function_exists('link_tag')) {
219 219
     /**
220 220
      * Link
221 221
      *
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             $href      = $href['href'] ?? '';
240 240
         }
241 241
 
242
-        if (! preg_match('#^([a-z]+:)?//#i', $href)) {
242
+        if (!preg_match('#^([a-z]+:)?//#i', $href)) {
243 243
             if ($indexPage === true) {
244 244
                 $link .= 'href="' . site_url($href) . '" ';
245 245
             } else {
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
         $link .= 'rel="' . $rel . '" ';
257 257
 
258
-        if (! in_array($rel, ['alternate', 'canonical'], true)) {
258
+        if (!in_array($rel, ['alternate', 'canonical'], true)) {
259 259
             $link .= 'type="' . $type . '" ';
260 260
         }
261 261
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
     }
272 272
 }
273 273
 
274
-if (! function_exists('video')) {
274
+if (!function_exists('video')) {
275 275
     /**
276 276
      * Video
277 277
      *
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             $video .= _space_indent() . $track . "\n";
309 309
         }
310 310
 
311
-        if (! empty($unsupportedMessage)) {
311
+        if (!empty($unsupportedMessage)) {
312 312
             $video .= _space_indent()
313 313
                     . $unsupportedMessage
314 314
                     . "\n";
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     }
319 319
 }
320 320
 
321
-if (! function_exists('audio')) {
321
+if (!function_exists('audio')) {
322 322
     /**
323 323
      * Audio
324 324
      *
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
             $audio .= "\n" . _space_indent() . $track;
355 355
         }
356 356
 
357
-        if (! empty($unsupportedMessage)) {
357
+        if (!empty($unsupportedMessage)) {
358 358
             $audio .= "\n" . _space_indent() . $unsupportedMessage . "\n";
359 359
         }
360 360
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
     }
363 363
 }
364 364
 
365
-if (! function_exists('_media')) {
365
+if (!function_exists('_media')) {
366 366
     /**
367 367
      * Generate media based tag
368 368
      *
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
             $media .= _space_indent() . $track . "\n";
389 389
         }
390 390
 
391
-        if (! empty($unsupportedMessage)) {
391
+        if (!empty($unsupportedMessage)) {
392 392
             $media .= _space_indent() . $unsupportedMessage . "\n";
393 393
         }
394 394
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
     }
397 397
 }
398 398
 
399
-if (! function_exists('source')) {
399
+if (!function_exists('source')) {
400 400
     /**
401 401
      * Source
402 402
      *
@@ -409,14 +409,14 @@  discard block
 block discarded – undo
409 409
      */
410 410
     function source(string $src, string $type = 'unknown', string $attributes = '', bool $indexPage = false): string
411 411
     {
412
-        if (! _has_protocol($src)) {
412
+        if (!_has_protocol($src)) {
413 413
             $src = $indexPage === true ? site_url($src) : slash_item('baseURL') . $src;
414 414
         }
415 415
 
416 416
         $source = '<source src="' . $src
417 417
                 . '" type="' . $type . '"';
418 418
 
419
-        if (! empty($attributes)) {
419
+        if (!empty($attributes)) {
420 420
             $source .= ' ' . $attributes;
421 421
         }
422 422
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     }
425 425
 }
426 426
 
427
-if (! function_exists('track')) {
427
+if (!function_exists('track')) {
428 428
     /**
429 429
      * Track
430 430
      *
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
     }
444 444
 }
445 445
 
446
-if (! function_exists('object')) {
446
+if (!function_exists('object')) {
447 447
     /**
448 448
      * Object
449 449
      *
@@ -457,14 +457,14 @@  discard block
 block discarded – undo
457 457
      */
458 458
     function object(string $data, string $type = 'unknown', string $attributes = '', array $params = [], bool $indexPage = false): string
459 459
     {
460
-        if (! _has_protocol($data)) {
460
+        if (!_has_protocol($data)) {
461 461
             $data = $indexPage === true ? site_url($data) : slash_item('baseURL') . $data;
462 462
         }
463 463
 
464 464
         $object = '<object data="' . $data . '" '
465 465
                 . $attributes . '>';
466 466
 
467
-        if (! empty($params)) {
467
+        if (!empty($params)) {
468 468
             $object .= "\n";
469 469
         }
470 470
 
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
     }
477 477
 }
478 478
 
479
-if (! function_exists('param')) {
479
+if (!function_exists('param')) {
480 480
     /**
481 481
      * Param
482 482
      *
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
     }
498 498
 }
499 499
 
500
-if (! function_exists('embed')) {
500
+if (!function_exists('embed')) {
501 501
     /**
502 502
      * Embed
503 503
      *
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
      */
510 510
     function embed(string $src, string $type = 'unknown', string $attributes = '', bool $indexPage = false): string
511 511
     {
512
-        if (! _has_protocol($src)) {
512
+        if (!_has_protocol($src)) {
513 513
             $src = $indexPage === true ? site_url($src) : slash_item('baseURL') . $src;
514 514
         }
515 515
 
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
     }
520 520
 }
521 521
 
522
-if (! function_exists('_has_protocol')) {
522
+if (!function_exists('_has_protocol')) {
523 523
     /**
524 524
      * Test the protocol of a URI.
525 525
      *
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
     }
532 532
 }
533 533
 
534
-if (! function_exists('_space_indent')) {
534
+if (!function_exists('_space_indent')) {
535 535
     /**
536 536
      * Provide space indenting.
537 537
      */
Please login to merge, or discard this patch.
brighty/system/Helpers/filesystem_helper.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 // CodeIgniter File System Helpers
13 13
 
14
-if (! function_exists('directory_map')) {
14
+if (!function_exists('directory_map')) {
15 15
     /**
16 16
      * Create a Directory Map
17 17
      *
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     }
60 60
 }
61 61
 
62
-if (! function_exists('directory_mirror')) {
62
+if (!function_exists('directory_mirror')) {
63 63
     /**
64 64
      * Recursively copies the files and directories of the origin directory
65 65
      * into the target directory, i.e. "mirror" its contents.
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
      */
71 71
     function directory_mirror(string $originDir, string $targetDir, bool $overwrite = true): void
72 72
     {
73
-        if (! is_dir($originDir = rtrim($originDir, '\\/'))) {
73
+        if (!is_dir($originDir = rtrim($originDir, '\\/'))) {
74 74
             throw new InvalidArgumentException(sprintf('The origin directory "%s" was not found.', $originDir));
75 75
         }
76 76
 
77
-        if (! is_dir($targetDir = rtrim($targetDir, '\\/'))) {
77
+        if (!is_dir($targetDir = rtrim($targetDir, '\\/'))) {
78 78
             @mkdir($targetDir, 0755, true);
79 79
         }
80 80
 
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
             $target = $targetDir . substr($origin, $dirLen);
92 92
 
93 93
             if ($file->isDir()) {
94
-                if (! is_dir($target)) {
94
+                if (!is_dir($target)) {
95 95
                     mkdir($target, 0755);
96 96
                 }
97
-            } elseif (! is_file($target) || ($overwrite && is_file($target))) {
97
+            } elseif (!is_file($target) || ($overwrite && is_file($target))) {
98 98
                 copy($origin, $target);
99 99
             }
100 100
         }
101 101
     }
102 102
 }
103 103
 
104
-if (! function_exists('write_file')) {
104
+if (!function_exists('write_file')) {
105 105
     /**
106 106
      * Write File
107 107
      *
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     }
136 136
 }
137 137
 
138
-if (! function_exists('delete_files')) {
138
+if (!function_exists('delete_files')) {
139 139
     /**
140 140
      * Delete Files
141 141
      *
@@ -160,18 +160,18 @@  discard block
 block discarded – undo
160 160
                 RecursiveIteratorIterator::CHILD_FIRST
161 161
             ) as $object) {
162 162
                 $filename = $object->getFilename();
163
-                if (! $hidden && $filename[0] === '.') {
163
+                if (!$hidden && $filename[0] === '.') {
164 164
                     continue;
165 165
                 }
166 166
 
167
-                if (! $htdocs || ! preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename)) {
167
+                if (!$htdocs || !preg_match('/^(\.htaccess|index\.(html|htm|php)|web\.config)$/i', $filename)) {
168 168
                     $isDir = $object->isDir();
169 169
                     if ($isDir && $delDir) {
170 170
                         rmdir($object->getPathname());
171 171
 
172 172
                         continue;
173 173
                     }
174
-                    if (! $isDir) {
174
+                    if (!$isDir) {
175 175
                         unlink($object->getPathname());
176 176
                     }
177 177
                 }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     }
185 185
 }
186 186
 
187
-if (! function_exists('get_filenames')) {
187
+if (!function_exists('get_filenames')) {
188 188
     /**
189 189
      * Get Filenames
190 190
      *
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                 RecursiveIteratorIterator::SELF_FIRST
209 209
             ) as $name => $object) {
210 210
                 $basename = pathinfo($name, PATHINFO_BASENAME);
211
-                if (! $hidden && $basename[0] === '.') {
211
+                if (!$hidden && $basename[0] === '.') {
212 212
                     continue;
213 213
                 }
214 214
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     }
231 231
 }
232 232
 
233
-if (! function_exists('get_dir_file_info')) {
233
+if (!function_exists('get_dir_file_info')) {
234 234
     /**
235 235
      * Get Directory File Information
236 236
      *
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
     }
277 277
 }
278 278
 
279
-if (! function_exists('get_file_info')) {
279
+if (!function_exists('get_file_info')) {
280 280
     /**
281 281
      * Get File Info
282 282
      *
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
      */
293 293
     function get_file_info(string $file, $returnedValues = ['name', 'server_path', 'size', 'date'])
294 294
     {
295
-        if (! is_file($file)) {
295
+        if (!is_file($file)) {
296 296
             return null;
297 297
         }
298 298
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
     }
343 343
 }
344 344
 
345
-if (! function_exists('symbolic_permissions')) {
345
+if (!function_exists('symbolic_permissions')) {
346 346
     /**
347 347
      * Symbolic Permissions
348 348
      *
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
     }
391 391
 }
392 392
 
393
-if (! function_exists('octal_permissions')) {
393
+if (!function_exists('octal_permissions')) {
394 394
     /**
395 395
      * Octal Permissions
396 396
      *
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     }
406 406
 }
407 407
 
408
-if (! function_exists('same_file')) {
408
+if (!function_exists('same_file')) {
409 409
     /**
410 410
      * Checks if two files both exist and have identical hashes
411 411
      *
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
     }
418 418
 }
419 419
 
420
-if (! function_exists('set_realpath')) {
420
+if (!function_exists('set_realpath')) {
421 421
     /**
422 422
      * Set Realpath
423 423
      *
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         // Resolve the path
434 434
         if (realpath($path) !== false) {
435 435
             $path = realpath($path);
436
-        } elseif ($checkExistence && ! is_dir($path) && ! is_file($path)) {
436
+        } elseif ($checkExistence && !is_dir($path) && !is_file($path)) {
437 437
             throw new InvalidArgumentException('Not a valid path: ' . $path);
438 438
         }
439 439
 
Please login to merge, or discard this patch.
brighty/system/Cookie/CookieStore.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         /**
46 46
          * @var Cookie[] $cookies
47 47
          */
48
-        $cookies = array_filter(array_map(static function (string $header) use ($raw) {
48
+        $cookies = array_filter(array_map(static function(string $header) use ($raw) {
49 49
             try {
50 50
                 return Cookie::fromHeaderString($header, $raw);
51 51
             } catch (CookieException $e) {
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         foreach ($cookies as $index => $cookie) {
225 225
             $type = is_object($cookie) ? get_class($cookie) : gettype($cookie);
226 226
 
227
-            if (! $cookie instanceof Cookie) {
227
+            if (!$cookie instanceof Cookie) {
228 228
                 throw CookieException::forInvalidCookieInstance([static::class, Cookie::class, $type, $index]);
229 229
             }
230 230
         }
Please login to merge, or discard this patch.
brighty/system/Cookie/Cookie.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
     #[ReturnTypeWillChange]
583 583
     public function offsetGet($offset)
584 584
     {
585
-        if (! $this->offsetExists($offset)) {
585
+        if (!$this->offsetExists($offset)) {
586 586
             throw new InvalidArgumentException(sprintf('Undefined offset "%s".', $offset));
587 587
         }
588 588
 
@@ -701,11 +701,11 @@  discard block
 block discarded – undo
701 701
             $expires = $expires->format('U');
702 702
         }
703 703
 
704
-        if (! is_string($expires) && ! is_int($expires)) {
704
+        if (!is_string($expires) && !is_int($expires)) {
705 705
             throw CookieException::forInvalidExpiresTime(gettype($expires));
706 706
         }
707 707
 
708
-        if (! is_numeric($expires)) {
708
+        if (!is_numeric($expires)) {
709 709
             $expires = strtotime($expires);
710 710
 
711 711
             if ($expires === false) {
@@ -746,11 +746,11 @@  discard block
 block discarded – undo
746 746
      */
747 747
     protected function validatePrefix(string $prefix, bool $secure, string $path, string $domain): void
748 748
     {
749
-        if (strpos($prefix, '__Secure-') === 0 && ! $secure) {
749
+        if (strpos($prefix, '__Secure-') === 0 && !$secure) {
750 750
             throw CookieException::forInvalidSecurePrefix();
751 751
         }
752 752
 
753
-        if (strpos($prefix, '__Host-') === 0 && (! $secure || $domain !== '' || $path !== '/')) {
753
+        if (strpos($prefix, '__Host-') === 0 && (!$secure || $domain !== '' || $path !== '/')) {
754 754
             throw CookieException::forInvalidHostPrefix();
755 755
         }
756 756
     }
@@ -772,11 +772,11 @@  discard block
 block discarded – undo
772 772
             $samesite = self::SAMESITE_LAX;
773 773
         }
774 774
 
775
-        if (! in_array(strtolower($samesite), self::ALLOWED_SAMESITE_VALUES, true)) {
775
+        if (!in_array(strtolower($samesite), self::ALLOWED_SAMESITE_VALUES, true)) {
776 776
             throw CookieException::forInvalidSameSite($samesite);
777 777
         }
778 778
 
779
-        if (strtolower($samesite) === self::SAMESITE_NONE && ! $secure) {
779
+        if (strtolower($samesite) === self::SAMESITE_NONE && !$secure) {
780 780
             throw CookieException::forInvalidSameSiteNone();
781 781
         }
782 782
     }
Please login to merge, or discard this patch.
brighty/system/View/Cell.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
         [$class, $method] = $this->determineClass($library);
72 72
 
73 73
         // Is it cached?
74
-        $cacheName = ! empty($cacheName)
74
+        $cacheName = !empty($cacheName)
75 75
             ? $cacheName
76 76
             : str_replace(['\\', '/'], '', $class) . $method . md5(serialize($params));
77 77
 
78
-        if (! empty($this->cache) && $output = $this->cache->get($cacheName)) {
78
+        if (!empty($this->cache) && $output = $this->cache->get($cacheName)) {
79 79
             return $output;
80 80
         }
81 81
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             $instance->initController(Services::request(), Services::response(), Services::logger());
87 87
         }
88 88
 
89
-        if (! method_exists($instance, $method)) {
89
+        if (!method_exists($instance, $method)) {
90 90
             throw ViewException::forInvalidCellMethod($class, $method);
91 91
         }
92 92
 
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
         $refParams  = $refMethod->getParameters();
99 99
 
100 100
         if ($paramCount === 0) {
101
-            if (! empty($paramArray)) {
101
+            if (!empty($paramArray)) {
102 102
                 throw ViewException::forMissingCellParameters($class, $method);
103 103
             }
104 104
 
105 105
             $output = $instance->{$method}();
106 106
         } elseif (($paramCount === 1)
107
-            && ((! array_key_exists($refParams[0]->name, $paramArray))
107
+            && ((!array_key_exists($refParams[0]->name, $paramArray))
108 108
             || (array_key_exists($refParams[0]->name, $paramArray)
109 109
             && count($paramArray) !== 1))
110 110
         ) {
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             }
122 122
 
123 123
             foreach (array_keys($paramArray) as $key) {
124
-                if (! isset($methodParams[$key])) {
124
+                if (!isset($methodParams[$key])) {
125 125
                     throw ViewException::forInvalidCellParameter($key);
126 126
                 }
127 127
             }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             $output = $instance->{$method}(...array_values($fireArgs));
130 130
         }
131 131
         // Can we cache it?
132
-        if (! empty($this->cache) && $ttl !== 0) {
132
+        if (!empty($this->cache) && $ttl !== 0) {
133 133
             $this->cache->save($cacheName, $output, $ttl);
134 134
         }
135 135
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function prepareParams($params)
149 149
     {
150
-        if (empty($params) || (! is_string($params) && ! is_array($params))) {
150
+        if (empty($params) || (!is_string($params) && !is_array($params))) {
151 151
             return [];
152 152
         }
153 153
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             unset($separator);
164 164
 
165 165
             foreach ($params as $p) {
166
-                if (! empty($p)) {
166
+                if (!empty($p)) {
167 167
                     [$key, $val] = explode('=', $p);
168 168
 
169 169
                     $newParams[trim($key)] = trim($val, ', ');
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             throw ViewException::forNoCellClass();
198 198
         }
199 199
 
200
-        if (! class_exists($class, true)) {
200
+        if (!class_exists($class, true)) {
201 201
             throw ViewException::forInvalidCellClass($class);
202 202
         }
203 203
 
Please login to merge, or discard this patch.
brighty/system/View/Parser.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
         $file = $this->viewPath . $view;
105 105
 
106
-        if (! is_file($file)) {
106
+        if (!is_file($file)) {
107 107
             $fileOrig = $file;
108 108
             $file     = $this->loader->locateFile($view, 'Views');
109 109
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function setData(array $data = [], ?string $context = null): RendererInterface
179 179
     {
180
-        if (! empty($context)) {
180
+        if (!empty($context)) {
181 181
             foreach ($data as $key => &$value) {
182 182
                 if (is_array($value)) {
183 183
                     foreach ($value as &$obj) {
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
         foreach ($matches as $match) {
286 286
             // Loop over each piece of $data, replacing
287 287
             // it's contents so that we know what to replace in parse()
288
-            $str = '';  // holds the new contents for this tag pair.
288
+            $str = ''; // holds the new contents for this tag pair.
289 289
 
290 290
             foreach ($data as $row) {
291 291
                 // Objects that have a `toArray()` method should be
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                     if (is_array($val)) {
308 308
                         $pair = $this->parsePair($key, $val, $match[1]);
309 309
 
310
-                        if (! empty($pair)) {
310
+                        if (!empty($pair)) {
311 311
                             $pairs[array_keys($pair)[0]] = true;
312 312
 
313 313
                             $temp = array_merge($temp, $pair);
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
                 // Now replace our placeholders with the new content.
329 329
                 foreach ($temp as $pattern => $content) {
330
-                    $out = $this->replaceSingle($pattern, $content, $out, ! isset($pairs[$pattern]));
330
+                    $out = $this->replaceSingle($pattern, $content, $out, !isset($pairs[$pattern]));
331 331
                 }
332 332
 
333 333
                 $str .= $out;
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
         }
478 478
 
479 479
         // Replace the content in the template
480
-        return preg_replace_callback($pattern, function ($matches) use ($content, $escape) {
480
+        return preg_replace_callback($pattern, function($matches) use ($content, $escape) {
481 481
             // Check for {! !} syntax to not escape this one.
482 482
             if (strpos($matches[0], '{!') === 0 && substr($matches[0], -2) === '!}') {
483 483
                 $escape = false;
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 
497 497
         // Our regex earlier will leave all chained values on a single line
498 498
         // so we need to break them apart so we can apply them all.
499
-        $filters = ! empty($matches[1]) ? explode('|', $matches[1]) : [];
499
+        $filters = !empty($matches[1]) ? explode('|', $matches[1]) : [];
500 500
 
501 501
         if ($escape && empty($filters) && ($context = $this->shouldAddEscaping($orig))) {
502 502
             $filters[] = "esc({$context})";
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
             $escape = false;
533 533
         }
534 534
         // If no `esc` filter is found, then we'll need to add one.
535
-        elseif (! preg_match('/\s+esc/', $key)) {
535
+        elseif (!preg_match('/\s+esc/', $key)) {
536 536
             $escape = 'html';
537 537
         }
538 538
 
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
             preg_match('/\([\w<>=\/\\\,:.\-\s\+]+\)/', $filter, $param);
552 552
 
553 553
             // Remove the () and spaces to we have just the parameter left
554
-            $param = ! empty($param) ? trim($param[0], '() ') : null;
554
+            $param = !empty($param) ? trim($param[0], '() ') : null;
555 555
 
556 556
             // Params can be separated by commas to allow multiple parameters for the filter
557
-            if (! empty($param)) {
557
+            if (!empty($param)) {
558 558
                 $param = explode(',', $param);
559 559
 
560 560
                 // Clean it up
@@ -566,9 +566,9 @@  discard block
 block discarded – undo
566 566
             }
567 567
 
568 568
             // Get our filter name
569
-            $filter = ! empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter);
569
+            $filter = !empty($param) ? trim(strtolower(substr($filter, 0, strpos($filter, '(')))) : trim($filter);
570 570
 
571
-            if (! array_key_exists($filter, $this->config->filters)) {
571
+            if (!array_key_exists($filter, $this->config->filters)) {
572 572
                 continue;
573 573
             }
574 574
 
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
              *   $matches[1] = all parameters string in opening tag
608 608
              *   $matches[2] = content between the tags to send to the plugin.
609 609
              */
610
-            if (! preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) {
610
+            if (!preg_match_all($pattern, $template, $matches, PREG_SET_ORDER)) {
611 611
                 continue;
612 612
             }
613 613
 
Please login to merge, or discard this patch.
brighty/system/View/View.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
         $this->renderVars['file'] = $this->viewPath . $this->renderVars['view'];
191 191
 
192
-        if (! is_file($this->renderVars['file'])) {
192
+        if (!is_file($this->renderVars['file'])) {
193 193
             $this->renderVars['file'] = $this->loader->locateFile($this->renderVars['view'], 'Views', empty($fileExt) ? 'php' : $fileExt);
194 194
         }
195 195
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         // Save current vars
205 205
         $renderVars = $this->renderVars;
206 206
 
207
-        $output = (function (): string {
207
+        $output = (function(): string {
208 208
             extract($this->tempData);
209 209
             ob_start();
210 210
             include $this->renderVars['file'];
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
         $this->logPerformance($this->renderVars['start'], microtime(true), $this->renderVars['view']);
232 232
 
233
-        if (($this->debug && (! isset($options['debug']) || $options['debug'] === true))
233
+        if (($this->debug && (!isset($options['debug']) || $options['debug'] === true))
234 234
             && in_array('CodeIgniter\Filters\DebugToolbar', service('filters')->getFiltersClass()['after'], true)
235 235
         ) {
236 236
             $toolbarCollectors = config(Toolbar::class)->collectors;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $saveData = $saveData ?? $this->saveData;
276 276
         $this->prepareTemplateData($saveData);
277 277
 
278
-        $output = (function (string $view): string {
278
+        $output = (function(string $view): string {
279 279
             extract($this->tempData);
280 280
             ob_start();
281 281
             eval('?>' . $view);
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
         $section = array_pop($this->sectionStack);
391 391
 
392 392
         // Ensure an array exists so we can store multiple entries for this.
393
-        if (! array_key_exists($section, $this->sections)) {
393
+        if (!array_key_exists($section, $this->sections)) {
394 394
             $this->sections[$section] = [];
395 395
         }
396 396
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
      */
403 403
     public function renderSection(string $sectionName)
404 404
     {
405
-        if (! isset($this->sections[$sectionName])) {
405
+        if (!isset($this->sections[$sectionName])) {
406 406
             echo '';
407 407
 
408 408
             return;
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
      *
420 420
      * @param bool $saveData
421 421
      */
422
-    public function include(string $view, ?array $options = null, $saveData = true): string
422
+    public function include(string $view, ?array $options = null, $saveData = true) : string
423 423
     {
424 424
         return $this->render($view, $options, $saveData);
425 425
     }
Please login to merge, or discard this patch.
brighty/system/View/Filters.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public static function date($value, string $format): string
36 36
     {
37
-        if (is_string($value) && ! is_numeric($value)) {
37
+        if (is_string($value) && !is_numeric($value)) {
38 38
             $value = strtotime($value);
39 39
         }
40 40
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
      */
215 215
     public static function round(string $value, $precision = 2, string $type = 'common')
216 216
     {
217
-        if (! is_numeric($precision)) {
217
+        if (!is_numeric($precision)) {
218 218
             $type      = $precision;
219 219
             $precision = 2;
220 220
         }
Please login to merge, or discard this patch.