mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°7302 Fix SetupUtilsTest::testHumanReadableSize
This commit is contained in:
@@ -910,12 +910,16 @@ class SetupUtils
|
||||
{
|
||||
$aSizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB');
|
||||
$index = 0;
|
||||
while (($fBytes > 1000) && ($index < count($aSizes)))
|
||||
{
|
||||
while (($fBytes > 1000) && ($index < count($aSizes))) {
|
||||
$index++;
|
||||
$fBytes = $fBytes / 1000;
|
||||
}
|
||||
|
||||
if ($index == 0) {
|
||||
// display int for bytes
|
||||
return sprintf('%d %s', $fBytes, $aSizes[$index]);
|
||||
}
|
||||
|
||||
return sprintf('%.2f %s', $fBytes, $aSizes[$index]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user