Skip to content

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Zrnik committed Mar 12, 2021
1 parent 3b60f80 commit f59ba74
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zrnik/cnb-exchange",
"description": "An exchange class for 'moneyphp/money' using czech national bank exchange rates.",
"version": "v1.0.0",
"version": "v1.1.0",
"minimum-stability": "stable",
"license": "MIT",
"authors": [
Expand Down
17 changes: 12 additions & 5 deletions src/Utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ public static function format(Money $money)
return $moneyFormatter->format($money);
}

/**
* This method is here, if you need to convert float value to
* the currency format with MORE THAN TWO decimal places precision.
*
* (My use-case was to show ratio of conversion on the invoice)
*
* @param float $floatAmount
* @param Currency $currency
* @return string
*/
public static function formatFloat(
float $floatAmount, Currency $currency
): string
Expand Down Expand Up @@ -100,9 +110,6 @@ public static function formatFloat(
$floatAmount, $decimalLength, $decimalSeparator, $thousandsSeparator
);


$result = str_replace($formattedExample, $formattedNumber, $correctFormat);

/*
var_dump([
"original" => $floatAmount,
Expand All @@ -111,13 +118,13 @@ public static function formatFloat(
"decimal_len" => $decimalLength,
"formatted_example" => $formattedExample,
"formatted" => $formattedNumber,
"result" => $result,
"result" => str_replace($formattedExample, $formattedNumber, $correctFormat),
"thousands_separator" => $thousandsSeparator,
"decimal_separator" => $decimalSeparator
]);
*/

return $result;
return str_replace($formattedExample, $formattedNumber, $correctFormat);
}

/**
Expand Down

0 comments on commit f59ba74

Please sign in to comment.