2 namespace TYPO3\CMS\Fluid\ViewHelpers\Format;
60 public function render($value = null, $decimals = 0, $decimalSeparator =
'.', $thousandsSeparator =
',')
62 return static::renderStatic(
65 'decimals' => $decimals,
66 'decimalSeparator' => $decimalSeparator,
67 'thousandsSeparator' => $thousandsSeparator
70 $this->renderingContext
84 $value = $arguments[
'value'];
85 if ($value === null) {
89 if (empty(self::$units)) {
92 if (!is_integer($value) && !is_float($value)) {
93 if (is_numeric($value)) {
94 $value = (float)$value;
99 $bytes = max($value, 0);
100 $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
101 $pow = min($pow, count(self::$units) - 1);
102 $bytes /= pow(2, (10 * $pow));
106 number_format(round($bytes, 4 * $arguments[
'decimals']), $arguments[
'decimals'], $arguments[
'decimalSeparator'], $arguments[
'thousandsSeparator']),