summaryrefslogtreecommitdiff
path: root/src/utils.php
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-04-22 17:19:39 +0500
committerilotterytea <iltsu@alright.party>2025-04-22 17:19:39 +0500
commit08e8563f94e8b46c08df4c231c838d32365d8f08 (patch)
treee13577b2f2d9fbde64203b714516ffd6d78fc780 /src/utils.php
parent34189e06a88ce4409a2c9652ca26f072c461233e (diff)
feat: show emote rating
Diffstat (limited to 'src/utils.php')
-rw-r--r--src/utils.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/utils.php b/src/utils.php
index 325603b..a11fa16 100644
--- a/src/utils.php
+++ b/src/utils.php
@@ -58,7 +58,13 @@ function format_timestamp(int $timestamp_secs)
return "$days day" . ($days > 1 ? "s" : "");
}
}
+
function clamp(int $current, int $min, int $max): int
{
return max($min, min($max, $current));
+}
+
+function in_range(float $value, float $min, float $max): bool
+{
+ return $min <= $value && $value <= $max;
} \ No newline at end of file