aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/Request.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Minz/Request.php')
-rw-r--r--lib/Minz/Request.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php
index 4bf6fa45c..c938afd7c 100644
--- a/lib/Minz/Request.php
+++ b/lib/Minz/Request.php
@@ -99,6 +99,18 @@ class Minz_Request {
return $plaintext ? $result : Minz_Helper::htmlspecialchars_utf8($result);
}
+ /**
+ * @return list<int>
+ */
+ public static function paramArrayInt(string $key): array {
+ if (empty(self::$params[$key]) || !is_array(self::$params[$key])) {
+ return [];
+ }
+ $result = array_filter(self::$params[$key], 'is_numeric');
+ $result = array_map('intval', $result);
+ return array_values($result);
+ }
+
public static function paramTernary(string $key): ?bool {
if (isset(self::$params[$key])) {
$p = self::$params[$key];