Class for converting between different unit-lengths as specified by CSS.
Methods | ||||
---|---|---|---|---|
public
|
__construct($output_precision = 4, $internal_precision = 10, $force_no_bcmath = false)
|
# | ||
public
|
convert(HTMLPurifier_Length $length, string $to_unit): HTMLPurifier_Length|bool
Converts a length object of one unit into another unit.
Converts a length object of one unit into another unit. |
# | ||
public
|
getSigFigs(string $n): int
Returns the number of significant figures in a string number.
Returns the number of significant figures in a string number. Parameters
Returnsnumber of sigfigs |
# |
Constants | ||
---|---|---|
public
|
ENGLISH = 1
|
# |
public
|
METRIC = 2
|
# |
public
|
DIGITAL = 3
|
# |
Properties | |||
---|---|---|---|
protected
static
|
|
$units = [
self::ENGLISH => ['px' => 3, 'pt' => 4, 'pc' => 48, 'in' => 288, self::METRIC => ['pt', '0.352777778', 'mm']],
self::METRIC => ['mm' => 1, 'cm' => 10, self::ENGLISH => ['mm', '2.83464567', 'pt']],
]
Units information array. Units are grouped into measuring systems
(English, Metric), and are assigned an integer…
Units information array. Units are grouped into measuring systems (English, Metric), and are assigned an integer representing the conversion factor between that unit and the smallest unit in the system. Numeric indexes are actually magical constants that encode conversion data from one system to the next, with a O(n^2) constraint on memory (this is generally not a problem, since the number of measuring systems is small.) |
# |
protected
|
|
$outputPrecision
Minimum bcmath precision for output.
Minimum bcmath precision for output. |
# |
protected
|
|
$internalPrecision
Bcmath precision for internal calculations.
Bcmath precision for internal calculations. |
# |