public function asDecimal($value, $decimals = null, $options = [], $textOptions = [])
{
if ($value === null) {
return $this->nullDisplay;
}
$value = $this->normalizeNumericValue($value);
if ($this->_intlLoaded) {
$f = $this->createNumberFormatter(NumberFormatter::DECIMAL, $decimals, $options, $textOptions);
if (($result = $f->format($value)) === false) {
throw new InvalidParamException('Formatting decimal value failed: ' . $f->getErrorCode() . ' ' . $f->getErrorMessage());
}
return $result;
} else {
if ($decimals === null) {
$decimals = 2;
}
return number_format($value, $decimals, $this->decimalSeparator, $this->thousandSeparator);
}
}