* Fix CI/CD php version

* Add Pint
* Format code
This commit is contained in:
Fabián Gonzalo Artur de la Villarmois
2026-03-29 17:49:51 +13:00
parent 0993bfa666
commit bae79d68ab
17 changed files with 114 additions and 59 deletions
+3 -2
View File
@@ -5,6 +5,7 @@ namespace App\Helpers;
class FileSize
{
private const UNITS = ['', 'K', 'M', 'G', 'T'];
private const THRESHOLD = 1024;
/**
@@ -18,10 +19,10 @@ class FileSize
$unitIndex = (int) floor(log($bytes, self::THRESHOLD));
$unitIndex = min($unitIndex, count(self::UNITS) - 1);
$size = $bytes / pow(self::THRESHOLD, $unitIndex);
$decimals = $unitIndex === 0 ? 0 : 2;
return number_format($size, $decimals, '.', '') . self::UNITS[$unitIndex];
return number_format($size, $decimals, '.', '').self::UNITS[$unitIndex];
}
}