Passed
Branch master (a1faa7)
by refat
03:26
created
Core/System/Validation/Validator.php 1 patch
Braces   +93 added lines, -31 removed lines patch added patch discarded remove patch
@@ -73,7 +73,9 @@  discard block
 block discarded – undo
73 73
    */
74 74
   public function require($call = true, $msg = null)
75 75
   {
76
-    if ($call === false) return $this;
76
+    if ($call === false) {
77
+      return $this;
78
+    }
77 79
 
78 80
     $value = $this->value();
79 81
 
@@ -105,11 +107,15 @@  discard block
 block discarded – undo
105 107
    */
106 108
   public function email($call = true, $msg = null)
107 109
   {
108
-    if ($call === false) return $this;
110
+    if ($call === false) {
111
+      return $this;
112
+    }
109 113
 
110 114
     $value = $this->value();
111 115
 
112
-    if (!$value && $value != '0') return $this;
116
+    if (!$value && $value != '0') {
117
+      return $this;
118
+    }
113 119
 
114 120
     if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
115 121
       $msg = $msg ?: 'e-mail is not valid';
@@ -128,11 +134,15 @@  discard block
 block discarded – undo
128 134
    */
129 135
   public function image($call = true, $msg = null)
130 136
   {
131
-    if ($call === false) return $this;
137
+    if ($call === false) {
138
+      return $this;
139
+    }
132 140
 
133 141
     $file = $this->app->request->file($this->input);
134 142
 
135
-    if (!$file->exists()) return $this;
143
+    if (!$file->exists()) {
144
+      return $this;
145
+    }
136 146
 
137 147
     if (!$file->isImage()) {
138 148
       $msg = $msg ?: 'image is not valid';
@@ -151,11 +161,15 @@  discard block
 block discarded – undo
151 161
    */
152 162
   public function number($call = true, $msg = null)
153 163
   {
154
-    if ($call === false) return $this;
164
+    if ($call === false) {
165
+      return $this;
166
+    }
155 167
 
156 168
     $value = $this->value();
157 169
 
158
-    if (!$value && $value != '0') return $this;
170
+    if (!$value && $value != '0') {
171
+      return $this;
172
+    }
159 173
 
160 174
     if (!is_numeric($value)) {
161 175
       $msg = $msg ?: 'this field must be a number';
@@ -174,11 +188,15 @@  discard block
 block discarded – undo
174 188
    */
175 189
   public function float($call = true, $msg = null)
176 190
   {
177
-    if ($call === false) return $this;
191
+    if ($call === false) {
192
+      return $this;
193
+    }
178 194
 
179 195
     $value = $this->value();
180 196
 
181
-    if (!$value && $value != '0') return $this;
197
+    if (!$value && $value != '0') {
198
+      return $this;
199
+    }
182 200
 
183 201
     if (!is_float($value)) {
184 202
       $msg = $msg ?: "this field must be a float number";
@@ -199,11 +217,15 @@  discard block
 block discarded – undo
199 217
    */
200 218
   public function date($options = [], $msg = null)
201 219
   {
202
-    if ($options === false) return $this;
220
+    if ($options === false) {
221
+      return $this;
222
+    }
203 223
 
204 224
     $value = $this->value();
205 225
 
206
-    if (!$value && $value != '0') return $this;
226
+    if (!$value && $value != '0') {
227
+      return $this;
228
+    }
207 229
 
208 230
     $options = json_encode($options);
209 231
     $options = json_decode($options);
@@ -244,11 +266,15 @@  discard block
 block discarded – undo
244 266
    */
245 267
   public function text($call = true, $msg = null)
246 268
   {
247
-    if ($call === false) return $this;
269
+    if ($call === false) {
270
+      return $this;
271
+    }
248 272
 
249 273
     $value = $this->value();
250 274
 
251
-    if (!$value && $value != '0') return $this;
275
+    if (!$value && $value != '0') {
276
+      return $this;
277
+    }
252 278
 
253 279
     if (!is_string($value)) {
254 280
       $msg = $msg ?: 'the field must be a text';
@@ -267,11 +293,15 @@  discard block
 block discarded – undo
267 293
    */
268 294
   public function noNumbers($call = true, $msg = null)
269 295
   {
270
-    if ($call === false) return $this;
296
+    if ($call === false) {
297
+      return $this;
298
+    }
271 299
 
272 300
     $value = $this->value();
273 301
 
274
-    if (!$value && $value != '0') return $this;
302
+    if (!$value && $value != '0') {
303
+      return $this;
304
+    }
275 305
 
276 306
     if (preg_match('~[0-9]~', $value)) {
277 307
       $msg = $msg ?: 'numbers are not allow';
@@ -291,11 +321,15 @@  discard block
 block discarded – undo
291 321
    */
292 322
   public function characters($excepts, $msg = null)
293 323
   {
294
-    if ($excepts === false) return $this;
324
+    if ($excepts === false) {
325
+      return $this;
326
+    }
295 327
 
296 328
     $value = $this->value();
297 329
 
298
-    if (!$value && $value != '0') return $this;
330
+    if (!$value && $value != '0') {
331
+      return $this;
332
+    }
299 333
 
300 334
     extract($this->charactersvariables($excepts, $value));
301 335
 
@@ -454,11 +488,15 @@  discard block
 block discarded – undo
454 488
    */
455 489
   public function noSpaces($call = true, $msg = null)
456 490
   {
457
-    if ($call === false) return $this;
491
+    if ($call === false) {
492
+      return $this;
493
+    }
458 494
 
459 495
     $value = $this->value();
460 496
 
461
-    if (!$value && $value != '0') return $this;
497
+    if (!$value && $value != '0') {
498
+      return $this;
499
+    }
462 500
 
463 501
     if (preg_match('/\s/', $value)) {
464 502
       $msg = $msg ?: 'spaces are not allow';
@@ -477,11 +515,15 @@  discard block
 block discarded – undo
477 515
    */
478 516
   public function containJust($characters = [], $msg = null)
479 517
   {
480
-    if ($characters === false) return $this;
518
+    if ($characters === false) {
519
+      return $this;
520
+    }
481 521
 
482 522
     $value = $this->value();
483 523
 
484
-    if (!$value && $value != '0') return $this;
524
+    if (!$value && $value != '0') {
525
+      return $this;
526
+    }
485 527
 
486 528
     if (!is_array($characters) && $characters !== '') {
487 529
       $characters = [$characters];
@@ -557,11 +599,15 @@  discard block
 block discarded – undo
557 599
    */
558 600
   public function length($length = null, $msg = null)
559 601
   {
560
-    if ($length === false) return $this;
602
+    if ($length === false) {
603
+      return $this;
604
+    }
561 605
 
562 606
     $value = $this->value();
563 607
 
564
-    if (!$value && $value != '0') return $this;
608
+    if (!$value && $value != '0') {
609
+      return $this;
610
+    }
565 611
 
566 612
     if (strlen($value) !== $length) {
567 613
       $msg = $msg ?: `this field can be just ${length} charachter`;
@@ -580,11 +626,15 @@  discard block
 block discarded – undo
580 626
    */
581 627
   public function maxLen($length = null, $msg = null)
582 628
   {
583
-    if ($length === false) return $this;
629
+    if ($length === false) {
630
+      return $this;
631
+    }
584 632
 
585 633
     $value = $this->value();
586 634
 
587
-    if (!$value && $value != '0') return $this;
635
+    if (!$value && $value != '0') {
636
+      return $this;
637
+    }
588 638
 
589 639
     if (strlen($value) > $length) {
590 640
       $msg = $msg ?: "this field can be maximum $length charachter";
@@ -603,11 +653,15 @@  discard block
 block discarded – undo
603 653
    */
604 654
   public function minLen($length = null, $msg = null)
605 655
   {
606
-    if ($length === false) return $this;
656
+    if ($length === false) {
657
+      return $this;
658
+    }
607 659
 
608 660
     $value = $this->value();
609 661
 
610
-    if (!$value && $value != '0') return $this;
662
+    if (!$value && $value != '0') {
663
+      return $this;
664
+    }
611 665
 
612 666
     if (strlen($value) < $length) {
613 667
       $msg = $msg ?: "this field can be minimum $length charachter";
@@ -626,7 +680,9 @@  discard block
 block discarded – undo
626 680
    */
627 681
   public function match($input, $msg = null)
628 682
   {
629
-    if ($input === false) return $this;
683
+    if ($input === false) {
684
+      return $this;
685
+    }
630 686
 
631 687
     $value = $this->value();
632 688
 
@@ -651,11 +707,15 @@  discard block
 block discarded – undo
651 707
    */
652 708
   public function unique($data = [], $msg = null)
653 709
   {
654
-    if ($data === false) return $this;
710
+    if ($data === false) {
711
+      return $this;
712
+    }
655 713
 
656 714
     $value = $this->value();
657 715
 
658
-    if (!$data) return $this;
716
+    if (!$data) {
717
+      return $this;
718
+    }
659 719
 
660 720
     if (is_array($data)) {
661 721
       list($table, $column) = $data;
@@ -713,7 +773,9 @@  discard block
 block discarded – undo
713 773
    */
714 774
   public function addError($input, $msg)
715 775
   {
716
-    if (!$this->hasError($input)) $this->errors[$input] = $msg;
776
+    if (!$this->hasError($input)) {
777
+      $this->errors[$input] = $msg;
778
+    }
717 779
   }
718 780
 
719 781
   /**
Please login to merge, or discard this patch.
App/Controllers/Admin/User/Traits/SearchTrait.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -130,7 +130,8 @@  discard block
 block discarded – undo
130 130
     return $sql;
131 131
   }
132 132
 
133
-  private function gender($gender, $sql, $wheres) {
133
+  private function gender($gender, $sql, $wheres)
134
+  {
134 135
     if ($gender) {
135 136
       $sql .= 'gender = ? AND ';
136 137
       array_push($wheres, $gender);
@@ -138,7 +139,8 @@  discard block
 block discarded – undo
138 139
     return [$sql, $wheres];
139 140
   }
140 141
 
141
-  private function zip($zip, $sql, $wheres) {
142
+  private function zip($zip, $sql, $wheres)
143
+  {
142 144
     if ($zip) {
143 145
       $sql .= 'zip = ? AND ';
144 146
       array_push($wheres, $zip);
@@ -146,7 +148,8 @@  discard block
 block discarded – undo
146 148
     return [$sql, $wheres];
147 149
   }
148 150
 
149
-  private function country($country, $sql, $wheres) {
151
+  private function country($country, $sql, $wheres)
152
+  {
150 153
     if ($country) {
151 154
       $sql .= 'country = ? AND ';
152 155
       array_push($wheres, $country);
@@ -154,7 +157,8 @@  discard block
 block discarded – undo
154 157
     return [$sql, $wheres];
155 158
   }
156 159
 
157
-  private function registration($registration_from, $registration_to, $sql, $wheres) {
160
+  private function registration($registration_from, $registration_to, $sql, $wheres)
161
+  {
158 162
     if ($registration_from) {
159 163
       $registration_from = date("Y-m-d", strtotime($registration_from));
160 164
 
Please login to merge, or discard this patch.
App/Controllers/Admin/User/Traits/AddTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
       'house_number' => $posts['house_number'],
91 91
       'additional' => $posts['additional'],
92 92
     ];
93
-    foreach($array as $key => $value) {
93
+    foreach ($array as $key => $value) {
94 94
       if (!$value) {
95 95
         $value = null;
96 96
       }
Please login to merge, or discard this patch.