Схема
public mixed
format (
$number, $currency = '', $value = '', $format = true )
Аргументы
Аргумент |
Возможный тип |
Описание |
$number |
— |
— |
$currency = '' |
— |
— |
$value = '' |
— |
— |
$format = true |
— |
— |
Описание
Метод пока еще не документирован.
Исходный код
if ($currency && $this->has($currency)) {
$symbol_left = $this->currencies[$currency]['symbol_left'];
$symbol_right = $this->currencies[$currency]['symbol_right'];
$decimal_place = $this->currencies[$currency]['decimal_place'];
} else {
$symbol_left = $this->currencies[$this->code]['symbol_left'];
$symbol_right = $this->currencies[$this->code]['symbol_right'];
$decimal_place = $this->currencies[$this->code]['decimal_place'];
$currency = $this->code;
}
if ($value) {
$value = $value;
} else {
$value = $this->currencies[$currency]['value'];
}
if ($value) {
$value = (float)$number * $value;
} else {
$value = $number;
}
$string = '';
if (($symbol_left) && ($format)) {
$string .= $symbol_left;
}
if ($format) {
$decimal_point = $this->language->get('decimal_point');
} else {
$decimal_point = '.';
}
if ($format) {
$thousand_point = $this->language->get('thousand_point');
} else {
$thousand_point = '';
}
$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);
if (($symbol_right) && ($format)) {
$string .= $symbol_right;
}
return $string;