public function formatTo(string $locale, bool $allowWholeNumber = false) : string
    {
        $scale = $this->amount->getScale();

        $formatter = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);

        if ($allowWholeNumber && ! $this->amount->hasNonZeroFractionalPart()) {
            $scale = 0;
        }

        $formatter->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, $scale);
        $formatter->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, $scale);

        return $this->formatWith($formatter);
    }