You are here

public function OrderConditionBase::compareComparisonOptions in Ubercart 8.4

Value comparison.

Parameters

float $source: The source value.

string $operator: The comparison operator.

float $target: The target value.

Return value

bool Whether the comparison meets the specified conditions.

4 calls to OrderConditionBase::compareComparisonOptions()
NumberOfProductsCondition::doEvaluate in uc_order/src/Plugin/Condition/NumberOfProductsCondition.php
Checks that the order has the selected number of products.
OrderSubtotalCondition::doEvaluate in uc_order/src/Plugin/Condition/OrderSubtotalCondition.php
Compares order subtotal.
OrderTotalCondition::doEvaluate in uc_order/src/Plugin/Condition/OrderTotalCondition.php
Compares order total.
OrderTotalWeightCondition::doEvaluate in uc_order/src/Plugin/Condition/OrderTotalWeightCondition.php
Checks the weight of the order's products.

File

uc_order/src/Plugin/Condition/OrderConditionBase.php, line 80

Class

OrderConditionBase
Base class containing useful functions for some Order conditions.

Namespace

Drupal\uc_order\Plugin\Condition

Code

public function compareComparisonOptions($source, $operator, $target) {
  switch ($operator) {
    case 'less':
      return $source < $target;
    case 'less_equal':
      return $source <= $target;
    case 'equal':
      return $source == $target;
    case 'greater_equal':
      return $source >= $target;
    case 'greater':
      return $source > $target;
  }
}