danielme85 / laravel-cconverter

A simple currency converter plugin for Laravel 5. Currency providers: The European Central Bank, OpenExchange, CurrencyLayer and fixer.io
https://danielmellum.com/projects/currency-converter
MIT License
42 stars 10 forks source link

couldn't round with precision = 0 #5

Closed longnd closed 8 years ago

longnd commented 8 years ago

the convert function expects the 3rd parameters is the number of decimal to round public function convert($from = null, $to, $int, $round = null, $date = null) {...}

but it doesn't work if we want to round the result with precision = 0 pls have a look at this line https://github.com/danielme85/Laravel-CConverter/blob/master/src/Currency.php#L347 if ($round) { $result = round($result, $round); } the condition checking will lead to fail if the $round parameter passed to the convert function is 0

danielme85 commented 8 years ago

You are absolutely right, should be fixed in master now ( c4919be ): null = no rounding, 0 = round to 0 decimals. Thanks @longnd !