refactor: move ByteConverter from Helpers to Services namespace
- Move ByteConverter class to App\Ship\Services - Update all imports across Filament form blocks - Update ByteConverterServiceProvider - Add INTEGRATION_CREDENTIAL_PREFIX to CacheKeys enum
This commit is contained in:
Executable
+17
@@ -0,0 +1,17 @@
|
||||
<?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];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user