26 $this->currencies = $currencies;
37 if ($valueBase[0] ===
'-') {
39 $valueBase = substr($valueBase, 1);
42 $subunit = $this->currencies->subunitFor($money->
getCurrency());
43 $valueLength = strlen($valueBase);
45 if ($valueLength > $subunit) {
46 $formatted = substr($valueBase, 0, $valueLength - $subunit);
47 $decimalDigits = substr($valueBase, $valueLength - $subunit);
49 if (strlen($decimalDigits) > 0) {
50 $formatted .=
'.'.$decimalDigits;
53 $formatted =
'0.'.str_pad(
'', $subunit - $valueLength,
'0').$valueBase;
56 if ($negative ===
true) {
57 $formatted =
'-'.$formatted;