You are here

public function UnitsConstantMathematicalExpression::formatQuantity in Units of Measurement 7.2

Format a certain amount of quantity within this mathematical expression.

Parameters

float $quantity: Quantity to be formatted

Return value

UnitsMathematicalExpression Formatted quantity into this mathematical expression. Sometimes the mathematical expression itself must mutate in order to format the quantity. So the returned mathematical expression may not necessarily be the mathematical expression on which this method was invoked. For example, the expression "unit" would mutate into "1 * unit" in order to have a dimensionless member and therefore be able to format the $quantity

Overrides UnitsMathematicalExpression::formatQuantity

File

./units.module, line 1790
Provide API for managing and converting units of measurement.

Class

UnitsConstantMathematicalExpression
Implementation of "mathematical expression" interface for a constant.

Code

public function formatQuantity($quantity) {
  $this->constant = $quantity;
  return $this;
}