public function Currency::getDecimals in Currency 8.3
1 call to Currency::getDecimals()
- Currency::formatAmount in src/Entity/Currency.php
- Format an amount using this currency and the environment's default currency locale.
pattern.
File
- src/Entity/Currency.php, line 284
Class
- Currency
- Defines a currency entity class.
Namespace
Drupal\currency\Entity
Code
public function getDecimals() {
$decimals = 0;
if ($this
->getSubunits() > 0) {
$decimals = 1;
while (pow(10, $decimals) < $this
->getSubunits()) {
$decimals++;
}
}
return $decimals;
}