You are here

public function AdjustmentTransformerInterface::roundAdjustment in Commerce Core 8.2

Rounds an adjustment to its currency precision.

For example, a USD adjustment will be rounded to 2 decimals.

Parameters

\Drupal\commerce_order\Adjustment $adjustment: The adjustment.

int $mode: The rounding mode. One of the following constants: PHP_ROUND_HALF_UP, PHP_ROUND_HALF_DOWN, PHP_ROUND_HALF_EVEN, PHP_ROUND_HALF_ODD.

Return value

\Drupal\commerce_order\Adjustment The rounded adjustment.

1 method overrides AdjustmentTransformerInterface::roundAdjustment()
AdjustmentTransformer::roundAdjustment in modules/order/src/AdjustmentTransformer.php
Rounds an adjustment to its currency precision.

File

modules/order/src/AdjustmentTransformerInterface.php, line 81

Class

AdjustmentTransformerInterface
Provides common logic for processing and transforming adjustments.

Namespace

Drupal\commerce_order

Code

public function roundAdjustment(Adjustment $adjustment, $mode = PHP_ROUND_HALF_UP);