amount_to_digit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * This file is part of the mucts.com.
4
 *
5
 * This source file is subject to the MIT license that is bundled
6
 * with this source code in the file LICENSE.
7
 *
8
 * @version 1.0
9
 * @author herry<[email protected]>
10
 * @copyright © 2020 MuCTS.com All Rights Reserved.
11
 */
12
13
use MuCTS\Money\Chinese\Convert;
14
15
if (!function_exists('amount_to_cn')) {
16
    /**
17
     * 金额转换成中文
18
     *
19
     * @param string|int|float $amount
20
     * @param string $prefix
21
     * @param string $cnPrefix
22
     * @return string
23
     */
24
    function amount_to_cn($amount, string $prefix = '¥', string $cnPrefix = '人民币')
25
    {
26
        return Convert::toCn($amount, $prefix, $cnPrefix);
27
    }
28
}
29
30
if (!function_exists('amount_to_digit')) {
31
    /**
32
     * 金额转换成阿拉伯数字
33
     *
34
     * @param string|int|float $amount
35
     * @param string $prefix
36
     * @param string $cnPrefix
37
     * @return string
38
     */
39
    function amount_to_digit($amount, string $prefix = '¥', string $cnPrefix = '人民币')
40
    {
41
        return Convert::toDigit($amount, $prefix, $cnPrefix);
42
    }
43
}