Conditions | 1 |
Paths | 1 |
Total Lines | 6 |
Code Lines | 3 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
35 | protected function convertBytes($bytes, int $decimal_places = 2, array $byte_suffixes = null) |
||
36 | { |
||
37 | $byte_suffixes = $byte_suffixes ?? $this->byte_suffixes; |
||
38 | $factor = floor((strlen($bytes) - 1) / 3); |
||
39 | |||
40 | return sprintf("%.{$decimal_places}f", $bytes / pow(1024, $factor)) . ' ' . $byte_suffixes[(int) $factor] ?? ''; |
||
41 | } |
||
43 |