| 1 | <?php |
||
| 20 | class FileSizeRenderer { |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Size divider "Gio". |
||
| 24 | * |
||
| 25 | * @var int |
||
| 26 | */ |
||
| 27 | const SIZE_DIVIDER_GIO = 1073741824; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Size divider "Kio". |
||
| 31 | * |
||
| 32 | * @var int |
||
| 33 | */ |
||
| 34 | const SIZE_DIVIDER_KIO = 1024; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Size divider "Mio". |
||
| 38 | * |
||
| 39 | * @var int |
||
| 40 | */ |
||
| 41 | const SIZE_DIVIDER_MIO = 1048576; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Render a size. |
||
| 45 | * |
||
| 46 | * @param int|null $size The size. |
||
| 47 | * @param int $decimals The decimals. |
||
| 48 | * @return string Returns the rendered size. |
||
| 49 | */ |
||
| 50 | public static function renderSize(?int $size, int $decimals = 2): string { |
||
| 68 | } |
||
| 69 |