| Total Complexity | 4 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class Size |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var array |
||
| 14 | */ |
||
| 15 | private static $units = [ |
||
| 16 | 'B', |
||
| 17 | 'KB', |
||
| 18 | 'MB', |
||
| 19 | 'GB', |
||
| 20 | 'TB', |
||
| 21 | 'PB', |
||
| 22 | 'EB', |
||
| 23 | 'ZB', |
||
| 24 | 'YB' |
||
| 25 | ]; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var string |
||
| 29 | */ |
||
| 30 | private static $unitsPattern = 'bkmgtpezy'; |
||
| 31 | /** |
||
| 32 | * @var string |
||
| 33 | */ |
||
| 34 | private static $unitsRegexPattern = '/[^bkmgtpezy]/i'; |
||
| 35 | /** |
||
| 36 | * @var string |
||
| 37 | */ |
||
| 38 | private static $numberRegex = '/[^0-9\.]/'; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param int $bytes |
||
| 42 | * |
||
| 43 | * @return string |
||
| 44 | * |
||
| 45 | * https://stackoverflow.com/a/11860664/1757763 |
||
| 46 | */ |
||
| 47 | public static function bytesToFormat(int $bytes): string |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param string $format |
||
| 55 | * |
||
| 56 | * @return float |
||
| 57 | * |
||
| 58 | * https://stackoverflow.com/a/25370978/1757763 |
||
| 59 | */ |
||
| 60 | public static function formatToBytes(string $format): float |
||
| 65 | } |
||
| 66 | } |