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