PostScripton/laravel-money

Add `ClarifyingSymbol` to `CurrencyDisplay`

PostScripton opened this issue · 0 comments

This means that currencies with, for example, $ symbol will identify their true nature.

For example, both Canadian and American dollars have the same symbol $, and in order to understand which is which, ClarifyingSymbol comes into place.

$cad = currency('CAD')->setDisplay(CurrencyDisplay::ClarifyingSymbol);
$cadMoney = money('2500', $cad);

$usd = currency('USD')->setDisplay(CurrencyDisplay::ClarifyingSymbol);
$usdMoney = money('2500', $usd);

$cadMoney->toString(); // "CA$ 0.25"
$usdMoney->toString(); // "US$ 0.25"

⚠️ This will work only for currencies with the same symbols.