22 const GiB = 1073741824;
23 const TiB = 1099511627776;
24 const PiB = 1125899906842624;
25 const EiB = 1152921504606846976;
26 const ZiB = 1180591620717411303424;
27 const YiB = 1208925819614629174706176;
32 const GB = 1000000000;
33 const TB = 1000000000000;
34 const PB = 1000000000000000;
35 const EB = 1000000000000000000;
36 const ZB = 1000000000000000000000;
37 const YB = 1000000000000000000000000;
94 throw new \InvalidArgumentException(
"Size must be of the type int.");
98 throw new \InvalidArgumentException(
"Unit must be of the type int.");
101 if (!isset(self::$suffixMap[
$unit])) {
102 throw new \InvalidArgumentException(
'The given data size unit is not valid, please check the provided class constants of the DataSize class.');
107 $this->suffix = self::$suffixMap[
$unit];
145 return "{$this->size} {$this->suffix}";
__construct($size, $unit)
DataSize constructor.
__toString()
Returns the data size with the corresponding suffix.
getSize()
The calculated data size.
getUnit()
The unit which equals the class constant used to calculate the data size.