| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | 15 | protected function validate($buildType = self::BUILD_FOR_CREATE) |
|
| 39 | { |
||
| 40 | 15 | $requiredFields = $this->getRequiredFields($buildType); |
|
| 41 | |||
| 42 | 15 | if (empty($requiredFields)) { |
|
| 43 | 3 | return; |
|
| 44 | } |
||
| 45 | |||
| 46 | 12 | $missingFields = array_diff_key(array_flip($requiredFields), $this->params); |
|
| 47 | 12 | if (!empty($missingFields)) { |
|
| 48 | 6 | throw new InvalidArgumentException(sprintf('Required parameters missing: %s', implode(', ', array_keys($missingFields)))); |
|
| 49 | } |
||
| 50 | 6 | } |
|
| 51 | } |
||
| 52 |