Conditions | 5 |
Paths | 10 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
50 | public function validate(array $values) : bool |
||
51 | 1 | { |
|
52 | 1 | $isEmpty = true; |
|
53 | 1 | ||
54 | foreach ($values as $key => $data) { |
||
55 | if (is_string($data)) { |
||
56 | 1 | $data = trim($data); |
|
57 | } |
||
58 | |||
59 | if (!empty($data)) { |
||
60 | $isEmpty = false; |
||
61 | $this->validData[$key] = $data; |
||
62 | } |
||
63 | } |
||
64 | 1 | ||
65 | if ($isEmpty) { |
||
66 | 1 | $this->errors[] = 'This field is mandatory and cannot be empty'; |
|
67 | return false; |
||
68 | } |
||
69 | |||
70 | return true; |
||
71 | } |
||
93 |