You are here

public function UnitsMathematicalOperatorNonLinear::__construct in Units of Measurement 7.2

Constructor.

Parameters

array $operator: Definition of a cTools 'operator' plugin that represents the specific operator

\UnitsConstantMathematicalExpression $operand1: Operand #1 for this mathematical expression

\UnitsEntity $operand2: Operand #2 for this mathematical expression

Throws

UnitsMathematicalExpressionMalformedException Exception is thrown if the linearity is not consistent (none or both non-linear operands)

Overrides AbstractUnitsMathematicalOperator::__construct

File

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

Class

UnitsMathematicalOperatorNonLinear
Implementation of "mathematical operator" interface for non-linear operation.

Code

public function __construct(array $operator, \UnitsConstantMathematicalExpression $operand1, \UnitsEntity $operand2) {
  parent::__construct($operator, $operand1, $operand2);
  if ($this
    ->nonLinearMember()
    ->isLinear()) {
    throw new UnitsMathematicalExpressionMalformedException(t('Expression %expression operates on 2 linear members while the operator is non-linear.', array(
      '%expression' => $this
        ->toInfix(),
    )));
  }
}