|
- <?php
-
-
-
- namespace common\helpers;
-
- class Price
- {
-
- public static function format($number)
- {
- return self::numberTwoDecimals($number).' €';
- }
-
- public static function getPrice($priceWithTax, $taxRate)
- {
- return floatval($priceWithTax) / ($taxRate + 1);
- }
-
- public static function getPriceWithTax($priceWithoutTax, $taxRate)
- {
- return self::numberTwoDecimals(floatval($priceWithoutTax) * ($taxRate + 1)) ;
- }
-
- public static function numberTwoDecimals($number)
- {
- return number_format(( ($number * 100)) / 100, 2) ;
- }
-
- }
|