bytic /
money
| 1 | <?php |
||
| 2 | |||
| 3 | namespace ByTIC\Money\Utility; |
||
| 4 | |||
| 5 | use Money\Currency; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * Class Money |
||
| 9 | * @package ByTIC\Money\Utility |
||
| 10 | */ |
||
| 11 | class Money |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @param $value |
||
| 15 | * @param null $currency |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 16 | */ |
||
| 17 | public static function fromFloat($value, $currency = null) |
||
| 18 | { |
||
| 19 | $value = floatval($value); |
||
| 20 | return \ByTIC\Money\Money::parse($value, $currency); |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param $value |
||
| 25 | * @param null $currency |
||
|
0 ignored issues
–
show
|
|||
| 26 | * @deprecated use ByTIC\Money\Money::currency |
||
| 27 | 2 | */ |
|
| 28 | public static function create($value, $currency = null) |
||
| 29 | 2 | { |
|
| 30 | 2 | $currency = \ByTIC\Money\Money::currency($currency); |
|
| 31 | return \ByTIC\Money\Money::parseByDecimal($value, $currency); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param $code |
||
| 36 | * @return Currency |
||
| 37 | 2 | * @deprecated use ByTIC\Money\Money::currency |
|
| 38 | */ |
||
| 39 | 2 | public static function currency($code = null) |
|
| 40 | 2 | { |
|
| 41 | return \ByTIC\Money\Money::currency($code); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @return string |
||
| 46 | 2 | * @deprecated use ByTIC\Money\Money::currencyDefault |
|
| 47 | */ |
||
| 48 | 2 | public static function currencyDefault() |
|
| 49 | { |
||
| 50 | return \ByTIC\Money\Money::currencyDefault(); |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Get currencies. |
||
| 55 | * |
||
| 56 | * @return \Money\Currencies |
||
| 57 | * @deprecated use ByTIC\Money\Money::getCurrencies |
||
| 58 | */ |
||
| 59 | public static function getCurrencies() |
||
| 60 | { |
||
| 61 | return \ByTIC\Money\Money::getCurrencies(); |
||
| 62 | } |
||
| 63 | } |