UnitConverter
in package
implements
UnitConverterInterface
FinalYes
Converts quantities to different units.
Tags
Table of Contents
Interfaces
- UnitConverterInterface
- Converts quantities to different units.
Constants
- PRECISION_INTERNAL = 5
- Floating-point precision of internal calculations.
- PRECISION_RESULT = 3
- Number of decimal places left in the converted quantity.
Methods
- convert() : QuantityInterface
- Converts the source quantity to target unit.
Constants
PRECISION_INTERNAL
Floating-point precision of internal calculations.
private
mixed
PRECISION_INTERNAL
= 5
PRECISION_RESULT
Number of decimal places left in the converted quantity.
private
mixed
PRECISION_RESULT
= 3
Methods
convert()
Converts the source quantity to target unit.
public
convert(QuantityInterface $from, UnitInterface $to) : QuantityInterface
Parameters
- $from : QuantityInterface
-
source quantity
- $to : UnitInterface
-
target unit
Tags
Return values
QuantityInterface —converted quantity