You are here

protected function AbstractUnitsMathematicalOperator::evaluateOperands in Units of Measurement 7.2

Numerically evaluate both operands and return them as an array.

Return value

array Array of length 2: the 2 operands numerically evaluated

4 calls to AbstractUnitsMathematicalOperator::evaluateOperands()
AbstractUnitsMathematicalOperator::dimension in ./units.module
Determine physical dimension of this mathematical expression.
AbstractUnitsMathematicalOperator::evaluate in ./units.module
Numerically evaluate this mathematical expression.
AbstractUnitsMathematicalOperator::formatQuantity in ./units.module
Format a certain amount of quantity within this mathematical expression.
AbstractUnitsMathematicalOperator::isolateOperand in ./units.module
Numerically isolate a certain operand of this mathematical expression.

File

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

Class

AbstractUnitsMathematicalOperator
Abstract implementation of "mathematical operator" interface.

Code

protected function evaluateOperands() {
  $evaluate1 = $this->operand1
    ->evaluate();
  $evaluate2 = $this->operand2
    ->evaluate();
  if (is_null($evaluate1)) {
    $evaluate1 = $this->operator['transparent operand1'];
  }
  if (is_null($evaluate2)) {
    $evaluate2 = $this->operator['transparent operand2'];
  }
  return array(
    $evaluate1,
    $evaluate2,
  );
}