aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-01-23 10:55:31 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2023-02-07 11:23:29 +0100
commit94ecae4ade0b618c024708b747ee7da8b0fb7113 (patch)
tree7696ec87b3c201ede05403eb4878d4a680048954 /lib/public
parent0f8c34cdc65046d68339127849724ea6383aa4a8 (diff)
downloadnextcloud-server-94ecae4ade0b618c024708b747ee7da8b0fb7113.tar.gz
nextcloud-server-94ecae4ade0b618c024708b747ee7da8b0fb7113.zip
Add helper to cast to int|float, fix MemoryInfo on 32bits
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/Util.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/public/Util.php b/lib/public/Util.php
index b2b3322fe86..dcb2ac4878f 100644
--- a/lib/public/Util.php
+++ b/lib/public/Util.php
@@ -340,6 +340,17 @@ class Util {
}
/**
+ * Converts string to int of float depending if it fits an int
+ * @param numeric-string $number numeric string
+ * @return int|float int if it fits, float if it is too big
+ * @since 26.0.0
+ */
+ public static function numericToNumber(string $number): int|float {
+ /* This is a hack to cast to (int|float) */
+ return 0 + $number;
+ }
+
+ /**
* Make a human file size (2048 to 2 kB)
* @param int $bytes file size in bytes
* @return string a human readable file size