| @@ 33-42 (lines=10) @@ | ||
| 30 | * @param string $dictionary |
|
| 31 | * @return string |
|
| 32 | */ |
|
| 33 | public static function toWords($number, string $dictionary = N2W::STANDARD_DICTIONARY): string |
|
| 34 | { |
|
| 35 | $n2w = Instance::ensure(static::$n2w, N2W::class); |
|
| 36 | $currentDictionary = $n2w->dictionary; |
|
| 37 | $n2w->dictionary = $dictionary; |
|
| 38 | $result = $n2w->toWords($number); |
|
| 39 | $n2w->dictionary = $currentDictionary; |
|
| 40 | ||
| 41 | return $result; |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * Chuyển đổi số sang tiền tệ. |
|
| @@ 52-61 (lines=10) @@ | ||
| 49 | * @param string $dictionary |
|
| 50 | * @return string |
|
| 51 | */ |
|
| 52 | public static function toCurrency($number, $unit = 'đồng', string $dictionary = N2W::STANDARD_DICTIONARY): string |
|
| 53 | { |
|
| 54 | $n2w = Instance::ensure(static::$n2w, N2W::class); |
|
| 55 | $currentDictionary = $n2w->dictionary; |
|
| 56 | $n2w->dictionary = $dictionary; |
|
| 57 | $result = $n2w->toCurrency($number, $unit); |
|
| 58 | $n2w->dictionary = $currentDictionary; |
|
| 59 | ||
| 60 | return $result; |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||