Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public static function getValueFromArray(array $sourceData, $key, $isRequired, $defaultValue) |
||
26 | { |
||
27 | if (array_key_exists($key, $sourceData)) { |
||
28 | return $sourceData[$key]; |
||
29 | } |
||
30 | |||
31 | if ($isRequired) { |
||
32 | throw new HttpException( |
||
33 | sprintf('missing required field "%s"', $key), |
||
34 | 400 |
||
35 | ); |
||
36 | } |
||
37 | |||
38 | return $defaultValue; |
||
39 | } |
||
40 | } |
||
41 |