src/I18n/Formatter.php
public function asShortSize($value, $decimals = null, $options = [], $textOptions = [])
    {
        if ($value === null) {
            return $this->nullDisplay;
        }

        list($params, $position) = $this->formatNumber($value, $decimals, 4, $this->sizeFormatBase, $options, $textOptions);

        if ($this->sizeFormatBase == 1024) {
            switch ($position) {
                case 0:
                    return Reaction::t('rct', '{nFormatted} B', $params, $this->locale);
                case 1:
                    return Reaction::t('rct', '{nFormatted} KiB', $params, $this->locale);
                case 2:
                    return Reaction::t('rct', '{nFormatted} MiB', $params, $this->locale);
                case 3:
                    return Reaction::t('rct', '{nFormatted} GiB', $params, $this->locale);
                case 4:
                    return Reaction::t('rct', '{nFormatted} TiB', $params, $this->locale);
                default:
                    return Reaction::t('rct', '{nFormatted} PiB', $params, $this->locale);
            }
        } else {
            switch ($position) {
                case 0:
                    return Reaction::t('rct', '{nFormatted} B', $params, $this->locale);
                case 1:
                    return Reaction::t('rct', '{nFormatted} KB', $params, $this->locale);
                case 2:
                    return Reaction::t('rct', '{nFormatted} MB', $params, $this->locale);
                case 3:
                    return Reaction::t('rct', '{nFormatted} GB', $params, $this->locale);
                case 4:
                    return Reaction::t('rct', '{nFormatted} TB', $params, $this->locale);
                default:
                    return Reaction::t('rct', '{nFormatted} PB', $params, $this->locale);
            }
        }
    }
public function asShortSize($value, $decimals = null, $options = [], $textOptions = [])
    {
        if ($value === null) {
            return $this->nullDisplay;
        }

        list($params, $position) = $this->formatNumber($value, $decimals, 4, $this->sizeFormatBase, $options, $textOptions);

        if ($this->sizeFormatBase == 1024) {
            switch ($position) {
                case 0:
                    return Reaction::t('rct', '{nFormatted} B', $params, $this->locale);
                case 1:
                    return Reaction::t('rct', '{nFormatted} KiB', $params, $this->locale);
                case 2:
                    return Reaction::t('rct', '{nFormatted} MiB', $params, $this->locale);
                case 3:
                    return Reaction::t('rct', '{nFormatted} GiB', $params, $this->locale);
                case 4:
                    return Reaction::t('rct', '{nFormatted} TiB', $params, $this->locale);
                default:
                    return Reaction::t('rct', '{nFormatted} PiB', $params, $this->locale);
            }
        } else {
            switch ($position) {
                case 0:
                    return Reaction::t('rct', '{nFormatted} B', $params, $this->locale);
                case 1:
                    return Reaction::t('rct', '{nFormatted} KB', $params, $this->locale);
                case 2:
                    return Reaction::t('rct', '{nFormatted} MB', $params, $this->locale);
                case 3:
                    return Reaction::t('rct', '{nFormatted} GB', $params, $this->locale);
                case 4:
                    return Reaction::t('rct', '{nFormatted} TB', $params, $this->locale);
                default:
                    return Reaction::t('rct', '{nFormatted} PB', $params, $this->locale);
            }
        }
    }
Formats the value in bytes as a size in human readable form for example `12 KB`.

This is the short form of [[asSize]].

If [[sizeFormatBase]] is 1024, [binary prefixes](http://en.wikipedia.org/wiki/Binary_prefix) (e.g. kibibyte/KiB, mebibyte/MiB, ...)
are used in the formatting result.

@param string|int|float $value value in bytes to be formatted.
@param int $decimals the number of digits after the decimal point.
@param array $options optional configuration for the number formatter. This parameter will be merged with [[numberFormatterOptions]].
@param array $textOptions optional configuration for the number formatter. This parameter will be merged with [[numberFormatterTextOptions]].
@return string the formatted result.
@throws InvalidArgumentException if the input value is not numeric or the formatting failed.
@see sizeFormatBase
@see asSize