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