function Helper::formatMemory
2 calls to Helper::formatMemory()
- ProgressBar::initPlaceholderFormatters in vendor/
symfony/ console/ Helper/ ProgressBar.php - ProgressIndicator::initPlaceholderFormatters in vendor/
symfony/ console/ Helper/ ProgressIndicator.php
File
-
vendor/
symfony/ console/ Helper/ Helper.php, line 128
Class
- Helper
- Helper is the base class for all helper classes.
Namespace
Symfony\Component\Console\HelperCode
public static function formatMemory(int $memory) : string {
if ($memory >= 1024 * 1024 * 1024) {
return \sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
}
if ($memory >= 1024 * 1024) {
return \sprintf('%.1f MiB', $memory / 1024 / 1024);
}
if ($memory >= 1024) {
return \sprintf('%d KiB', $memory / 1024);
}
return \sprintf('%d B', $memory);
}