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