| 1 |
<?php |
| 2 |
|
| 3 |
namespace Tamara\Wp\Plugin\Helpers; |
| 4 |
|
| 5 |
class MoneyHelper |
| 6 |
{ |
| 7 |
/** |
| 8 |
* Format the amount of money for Tamara SDK |
| 9 |
* |
| 10 |
* @param $amount |
| 11 |
* |
| 12 |
* @return float |
| 13 |
*/ |
| 14 |
public static function formatNumber($amount) |
| 15 |
{ |
| 16 |
return floatval(number_format(floatval($amount), 2, ".", "")); |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* Format the amount of money for general with 2 decimals |
| 21 |
* |
| 22 |
* @param $amount |
| 23 |
* |
| 24 |
* @return mixed |
| 25 |
*/ |
| 26 |
public static function formatNumberGeneral($amount) |
| 27 |
{ |
| 28 |
return number_format(floatval($amount), 2, ".", ""); |
| 29 |
} |
| 30 |
} |
| 31 |
|