| Conditions | 4 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | final protected function isValid(): bool |
||
| 35 | { |
||
| 36 | $fields = $this->getMandatoryFields(); |
||
| 37 | foreach ($this as $key => $value) { |
||
| 38 | if ($this->$key === null && in_array($key, $fields, true)) { |
||
| 39 | throw new MissingMandatoryField(sprintf( |
||
| 40 | 'The field "%s" is mandatory and empty, please correct', |
||
| 41 | $key |
||
| 42 | )); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | return true; |
||
| 47 | } |
||
| 74 |