Total Complexity | 11 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | class FileHelper |
||
15 | { |
||
16 | const BYTES_TO_MEGABYTES_RATIO = 1048576; |
||
17 | |||
18 | public static function convertBytesToMegabytes($b) |
||
19 | { |
||
20 | return round($b / self::BYTES_TO_MEGABYTES_RATIO, 2); |
||
21 | } |
||
22 | |||
23 | public static function convertMegabytesToBytes($mb) |
||
26 | } |
||
27 | |||
28 | public static function getMaxUploadSizeInBytes() |
||
29 | { |
||
30 | $maxPostSize = self::convertPHPSizeToBytes(ini_get('post_max_size')); |
||
31 | $maxUploadSize = self::convertPHPSizeToBytes(ini_get('upload_max_filesize')); |
||
32 | $memoryLimit = self::convertPHPSizeToBytes(ini_get('memory_limit')); |
||
33 | |||
34 | return min($maxPostSize, $maxUploadSize, $memoryLimit); |
||
35 | } |
||
36 | |||
37 | public static function getMaxUploadSizeInMegabytes() |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @param string $sSize |
||
46 | * |
||
47 | * @return int |
||
48 | */ |
||
49 | public static function convertPHPSizeToBytes($sSize) |
||
82 |