You are here

interface RounderInterface in Commerce Core 8.2

Rounds prices.

Hierarchy

Expanded class hierarchy of RounderInterface

All classes that implement RounderInterface

9 files declare their use of RounderInterface
AdjustmentTransformer.php in modules/order/src/AdjustmentTransformer.php
BuyXGetY.php in modules/promotion/src/Plugin/Commerce/PromotionOffer/BuyXGetY.php
Custom.php in modules/tax/src/Plugin/Commerce/TaxType/Custom.php
LocalTaxTypeBase.php in modules/tax/src/Plugin/Commerce/TaxType/LocalTaxTypeBase.php
OrderPromotionOfferBase.php in modules/promotion/src/Plugin/Commerce/PromotionOffer/OrderPromotionOfferBase.php

... See full list

File

modules/price/src/RounderInterface.php, line 8

Namespace

Drupal\commerce_price
View source
interface RounderInterface {

  /**
   * Rounds the given price to its currency precision.
   *
   * For example, USD prices will be rounded to 2 decimals.
   *
   * @param \Drupal\commerce_price\Price $price
   *   The price.
   * @param 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 \Drupal\commerce_price\Price
   *   The rounded price.
   *
   * @throws \InvalidArgumentException
   *   When given a price with an unknown currency.
   */
  public function round(Price $price, $mode = PHP_ROUND_HALF_UP);

}

Members

Namesort descending Modifiers Type Description Overrides
RounderInterface::round public function Rounds the given price to its currency precision. 1