@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | { |
14 | 14 | private $money; |
15 | 15 | |
16 | - private $uppers = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']; |
|
16 | + private $uppers = [ '零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖' ]; |
|
17 | 17 | |
18 | - private $units = ['分', '角']; |
|
18 | + private $units = [ '分', '角' ]; |
|
19 | 19 | |
20 | - private $grees = ['元', '拾', '佰', '仟', '万', '拾', '佰', '仟', '亿', '拾', '佰', '仟', '万', '拾', '佰']; |
|
20 | + private $grees = [ '元', '拾', '佰', '仟', '万', '拾', '佰', '仟', '亿', '拾', '佰', '仟', '万', '拾', '佰' ]; |
|
21 | 21 | |
22 | 22 | private $thanOne = false; |
23 | 23 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function setMoney($money = 0) |
48 | 48 | { |
49 | - if (!(is_float($money) || is_numeric($money) || is_int($money))) { |
|
49 | + if ( ! (is_float($money) || is_numeric($money) || is_int($money))) { |
|
50 | 50 | throw new \InvalidArgumentException($money); |
51 | 51 | } |
52 | 52 | if ($money > 1) { |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | $gree = strlen($intPart) - 1; |
98 | 98 | if ($intPart > 0) { |
99 | 99 | for ($i = 0; $i < strlen($intPart); ++$i) { |
100 | - $num = $intPart[$i]; |
|
101 | - $result .= $this->uppers[$num].$this->grees[$gree--]; |
|
100 | + $num = $intPart[ $i ]; |
|
101 | + $result .= $this->uppers[ $num ] . $this->grees[ $gree -- ]; |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | if ($decimalPart > 0) { |
131 | 131 | $unit = strlen($decimalPart) - 1; |
132 | 132 | for ($i = 0; $i < strlen($decimalPart); ++$i) { |
133 | - $num = $decimalPart[$i]; |
|
134 | - $result .= $this->uppers[$num].$this->units[$unit--]; |
|
133 | + $num = $decimalPart[ $i ]; |
|
134 | + $result .= $this->uppers[ $num ] . $this->units[ $unit -- ]; |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | $result = str_replace('零分', '', $result); |