Add new function MD_STD_IN::sanitize_id_or_zero_array()

This commit is contained in:
jrenslin committed 2026-11-02 17:28:43 +01:00
1 parent 38cb5c785d
commit 14997d5b56
1 file changed
+20 -1
+20 -1
View File
@@ -113,7 +113,7 @@ public static function sanitize_rgb_color(mixed $input):string {
} }
/** /**
* Valiates a list of entries, ensuring all returned values are valid IDs. * Validates a list of entries, ensuring all returned values are valid IDs.
* *
* @param array<mixed> $inputs Input array. * @param array<mixed> $inputs Input array.
* *
@@ -131,6 +131,25 @@ public static function sanitize_id_array(array $inputs):array {
} }
/**
* Validates a list of entries, ensuring all returned values are valid IDs.
*
* @param array<mixed> $inputs Input array.
*
* @return list<positive-int>
*/
public static function sanitize_id_or_zero_array(array $inputs):array {
$output = [];
foreach ($inputs as $input) {
$output[] = self::sanitize_id_or_zero($input);
}
return $output;
}
/** /**
* Converts an input value into a bool. Different from the default PHP way, * Converts an input value into a bool. Different from the default PHP way,
* the strings "false" and "False" are treated as negative. * the strings "false" and "False" are treated as negative.