Skip to content

Commit 0fd4fbb

Browse files
author
Denis Smetannikov
committed
Fixes
1 parent c0a69d7 commit 0fd4fbb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/FS.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,20 +307,20 @@ public static function format(int $bytes, $decimals = 2): string
307307
{
308308
$exp = 0;
309309
$value = 0;
310-
$symbol = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
310+
$symbols = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
311311

312312
$bytes = (float)$bytes;
313313

314314
if ($bytes > 0) {
315-
$exp = floor(log($bytes) / log(1024));
315+
$exp = (int)floor(log($bytes) / log(1024));
316316
$value = ($bytes / (1024 ** floor($exp)));
317317
}
318318

319-
if ($symbol[(int)$exp] === 'B') {
319+
if ($symbols[$exp] === 'B') {
320320
$decimals = 0;
321321
}
322322

323-
return number_format($value, $decimals, '.', '') . ' ' . $symbol[$exp];
323+
return number_format($value, $decimals, '.', '') . ' ' . $symbols[$exp];
324324
}
325325

326326
/**

0 commit comments

Comments
 (0)