@@ 42-49 (lines=8) @@ | ||
39 | * @param array $values Input array |
|
40 | * @param string[] $keys List of keys to remove |
|
41 | */ |
|
42 | public function removeEmptyFields(array &$values, array $keys) |
|
43 | { |
|
44 | foreach ($keys as $key) { |
|
45 | if (array_key_exists($key, $values) && empty($values[$key])) { |
|
46 | unset($values[$key]); |
|
47 | } |
|
48 | } |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * Force fields to be at 0 if empty. |
|
@@ 87-94 (lines=8) @@ | ||
84 | * @param array $values Input array |
|
85 | * @param string[] $keys List of keys |
|
86 | */ |
|
87 | public function convertNullFields(array &$values, array $keys) |
|
88 | { |
|
89 | foreach ($keys as $key) { |
|
90 | if (array_key_exists($key, $values) && empty($values[$key])) { |
|
91 | $values[$key] = null; |
|
92 | } |
|
93 | } |
|
94 | } |
|
95 | } |
|
96 |