public static function Helper::formatMemory in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Helper/Helper.php \Symfony\Component\Console\Helper\Helper::formatMemory()
2 calls to Helper::formatMemory()
- ProgressBar::initPlaceholderFormatters in vendor/
symfony/ console/ Helper/ ProgressBar.php - ProgressBarTest::testAnsiColorsAndEmojis in vendor/
symfony/ console/ Tests/ Helper/ ProgressBarTest.php - @requires extension mbstring
File
- vendor/
symfony/ console/ Helper/ Helper.php, line 92
Class
- Helper
- Helper is the base class for all helper classes.
Namespace
Symfony\Component\Console\HelperCode
public static function formatMemory($memory) {
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);
}