Conditions | 2 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 2.003 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | public function moneyHTMLFormat($amount) |
||
29 | 5 | { |
|
30 | $amount = floatval($amount); |
||
31 | 5 | $integerValue = floor($amount); |
|
32 | 5 | $decimalValue = round(($amount - $integerValue) * 100); |
|
33 | |||
34 | 5 | $intHTML = '<span class="money-int">'.number_format($integerValue).'</span>'; |
|
35 | 5 | ||
36 | $decimalValue = str_pad(strval($decimalValue), 2, '0', STR_PAD_LEFT); |
||
37 | 5 | $decimalHTML = '<sup class="money-decimal">.'.$decimalValue.'</sup>'; |
|
38 | |||
39 | 5 | $return = $intHTML.$decimalHTML; |
|
40 | 5 | ||
41 | $symbolHTML = '<span class="money-currency">'.$this->symbol.'</span>'; |
||
42 | if ($this->position == 'before') { |
||
43 | 5 | $return = $symbolHTML.' '.$amount; |
|
44 | } else { |
||
45 | $return .= ' '.$symbolHTML; |
||
46 | 5 | } |
|
47 | |||
48 | return '<span class="price" content="'.number_format($amount,2,'.','').'">'.$return.'</span>'; |
||
49 | } |
||
51 |