- Move ByteConverter class to App\Ship\Services - Update all imports across Filament form blocks - Update ByteConverterServiceProvider - Add INTEGRATION_CREDENTIAL_PREFIX to CacheKeys enum
17 lines
331 B
PHP
Executable File
17 lines
331 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Ship\Services;
|
|
|
|
class ByteConverter
|
|
{
|
|
public static function bytesToHuman($bytes)
|
|
{
|
|
$units = ['Б', 'КиБ', 'МиБ', 'ГиБ', 'ТиБ', 'ПиБ'];
|
|
|
|
for ($i = 0; $bytes > 1024; $i++) {
|
|
$bytes /= 1024;
|
|
}
|
|
|
|
return round($bytes, 2) . ' ' . $units[$i];
|
|
}
|
|
} |