public function RounderInterface::round in Commerce Core 8.2
Rounds the given price to its currency precision.
For example, USD prices will be rounded to 2 decimals.
Parameters
\Drupal\commerce_price\Price $price: The price.
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_price\Price The rounded price.
Throws
\InvalidArgumentException When given a price with an unknown currency.
1 method overrides RounderInterface::round()
- Rounder::round in modules/
price/ src/ Rounder.php - Rounds the given price to its currency precision.
File
- modules/
price/ src/ RounderInterface.php, line 27
Class
- RounderInterface
- Rounds prices.
Namespace
Drupal\commerce_priceCode
public function round(Price $price, $mode = PHP_ROUND_HALF_UP);