Returns a pretty formatted monetary value using the currency associated with a site.

@param int|string $value The monetary value to format.
@param int $idSite The ID of the site whose currency will be used.
@return string
@api
344265
public function getPrettyMoney($value, $idSite)
    {
        $space = ' ';
        $currencySymbol = Site::getCurrencySymbolFor($idSite);
        $currencyBefore =  $currencySymbol . $space;
        $currencyAfter = '';
        // (maybe more currencies prefer this notation?)
        $currencySymbolToAppend = array('€', 'kr', 'zł');
        // manually put the currency symbol after the amount
        if (in_array($currencySymbol, $currencySymbolToAppend)) {
            $currencyAfter = $space . $currencySymbol;
            $currencyBefore = '';
        }
        // if the input is a number (it could be a string or INPUT form),
        // and if this number is not an int, we round to precision 2
        if (is_numeric($value)) {
            if ($value == round($value)) {
                // 0.0 => 0
                $value = round($value);
            } else {
                $precision = GoalManager::REVENUE_PRECISION;
                $value = sprintf("%01." . $precision . "f", $value);
            }
        }
        $prettyMoney = $currencyBefore . $value . $currencyAfter;
        return $prettyMoney;
    }
275853
private function getValue(array $values, string $currency = null): string
    {
        $currency = !is_null($currency) ? strtolower($currency) : $this->provider->get();

        $values = array_change_key_case($values);

        return $values[$currency];
    }
872904
public function formatValue($value)
    {
        $formatter = $this->getValueFormatter();
        return (string)($formatter ? call_user_func($formatter, $value, $this->getGrid()->getCurrentRow()) : $value);
    }
1276144
public function GetFormattedCurrency($dValue)
    {
        $oLocal = &TCMSLocal::GetActive();
        $sValue = $oLocal->FormatNumber($dValue, 2).' '.$this->GetCurrencyDisplaySymbol();

        return $sValue;
    }
56561
public function formatByIntlLocalizedDecimal(
        $locale = null,
        Currencies $currencies = null,
        $style = NumberFormatter::CURRENCY
    ) {
        $numberFormatter = new NumberFormatter($locale ?: static::getLocale(), $style);
        $formatter = new IntlLocalizedDecimalFormatter($numberFormatter, $currencies ?: static::getCurrencies());

        return $this->formatByFormatter($formatter);
    }
143494
public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if (null === $value || '' === $value) {
            return $value;
        }

        if ( ! $value instanceof Money) {
            $type = is_object($value) ? get_class($value) : gettype($value);
            throw new \InvalidArgumentException(sprintf('You have to pass an object of kind \SerendipityHQ\Component\ValueObjects\Money\Money to use the Doctrine type MoneyType. "%s" passed instead.', $type));
        }

        return $value->getBaseAmount() . '-' . $value->getCurrency()->getCode();
    }
537103
public function formatByIntl($locale = null, Currencies $currencies = null, $style = NumberFormatter::CURRENCY)
    {
        $numberFormatter = new NumberFormatter($locale ?: static::getLocale(), $style);
        $formatter = new IntlMoneyFormatter($numberFormatter, $currencies ?: static::getCurrencies());

        return $this->formatByFormatter($formatter);
    }
810984
public function printMoney(MoneyInterface $money = null)
    {
        if (!($money instanceof MoneyInterface)) {
            return '';
        }

        if (!($money->getCurrency() instanceof CurrencyInterface)) {
            return $money->getAmount();
        }

        $moneyFormatter = new NumberFormatter(
            $this->locale->getIso(),
            NumberFormatter::CURRENCY
        );

        /**
         * The precision of the integer amount for a given Money
         * (cents, thousandths, 10-thousandths, etc) should be
         * stored in the Currency object. We assume amounts are
         * represented in cents.
         *
         * Loss of precision due to conversion is possible, but only when
         * displaying prices. This operation does not affect amounts
         */

        return $moneyFormatter
            ->formatCurrency(
                $money->getAmount() / 100,
                $money->getCurrency()->getIso()
            );
    }
338676
public static String formatCurrency(ITemplate template, Object data, String currencyCode) {
        return formatCurrency(template, data, currencyCode, null);
    }
409849
public function format($value, string $format = null)
    {
        $formatted = number_format(
            $value,
            $this->decimals,
            $format === 'nomask' ? '' : $this->decimal,
            $format === 'nomask' ? '' : $this->thousand
        );

        switch ($format) {
            case 'name':
                $name = $this->name_plural;
                if (!$name || (float) $value === 1.0) {
                    $name = $this->name;
                }
                return $formatted . ' ' . $name;
                break;

            case 'raw':
            case 'nomask':
                return $formatted;
                break;

            case 'symbol':
            default:
                return $this->symbol . ' ' . $formatted;
                break;
        }
    }
1214735
public function currencyFormat($locale = 'id_ID', $currency = 'IDR', $addSpace = true)
    {
        return currency_format($this->amount, $locale, $currency, $addSpace);
    }
1240923
public function parseCurrency($value, &$currency, &$position = NULL, $fmt, $value, &$currency, &$position = NULL)
    {
    }
331723
protected function formatValue($value)
    {
        if ($this->formatValue !== NULL) {
            return str_replace(static::VALUE_IDENTIFIER, $value, $this->formatValue);
        } else {
            return $value;
        }
    }
1030221
public function setAmount($value)
    {
        if ($value === null || $value === '') {
            $this->amount = new MonetaryAmount();
        } elseif (is_object($value) && $value instanceof AmountInterface) {
            $this->amount->setValue($value->getValue());
            $this->amount->setCurrency($value->getCurrency());
        } elseif (is_array($value)) {
            $this->amount->fromArray($value);
        } else {
            $this->amount->setValue($value);
        }

        return $this;
    }
502194
public static String formatCurrency(final Number value, final Locale locale)
    {
        return withinLocale(new Callable<String>()
        {
            public String call()
            {
                return formatCurrency(value);
            }
        }, locale);
    }
207770
public function formatWithoutCurrency($value)
    {
        $formatter = new NumberFormatter($this->locale(), NumberFormatter::DECIMAL);

        $code = $this->code($value);
        $divisor = $this->divisor($code);
        $amount = $this->convert($value, $divisor);

        return $formatter->formatCurrency($amount, $code);
    }
1006876
public function format($value, $params = null, $locale = null) {
		if ($locale === null) {
			$locale = 'en';
		}
		
		$formatter = $this->getFormatter($locale);
		
		if (isset($params['primary'])) {
			return $formatter->formatCurrency($value, $params['primary']);
		}

		if (isset($params['currency'])) {
			return $formatter->formatCurrency($value, $params['currency']);
		}
		
		trigger_error('The "currency" parameter was not specified');
		
		return $formatter->format($value);
	}