@@ 57-64 (lines=8) @@ | ||
54 | * @param array $values Input array |
|
55 | * @param string[] $keys List of keys |
|
56 | */ |
|
57 | public function resetFields(array &$values, array $keys) |
|
58 | { |
|
59 | foreach ($keys as $key) { |
|
60 | if (isset($values[$key]) && empty($values[$key])) { |
|
61 | $values[$key] = 0; |
|
62 | } |
|
63 | } |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * Force some fields to be integer. |
|
@@ 72-79 (lines=8) @@ | ||
69 | * @param array $values Input array |
|
70 | * @param string[] $keys List of keys |
|
71 | */ |
|
72 | public function convertIntegerFields(array &$values, array $keys) |
|
73 | { |
|
74 | foreach ($keys as $key) { |
|
75 | if (isset($values[$key])) { |
|
76 | $values[$key] = (int) $values[$key]; |
|
77 | } |
|
78 | } |
|
79 | } |
|
80 | ||
81 | /** |
|
82 | * Force some fields to be null if empty. |