| Total Complexity | 9 |
| Total Lines | 68 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 14 | trait RecordTrait |
||
| 15 | { |
||
| 16 | protected $_currency = null; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @return string |
||
| 20 | */ |
||
| 21 | public function printCurrencyAmount() |
||
| 22 | { |
||
| 23 | return $this->getCurrency()->moneyHTMLFormat($this->getCurrencyAmount()); |
||
|
|
|||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @return CurrencyTrait|Record |
||
| 28 | */ |
||
| 29 | public function getCurrency() |
||
| 30 | { |
||
| 31 | if ($this->_currency === null) { |
||
| 32 | $this->initCurrency(); |
||
| 33 | } |
||
| 34 | |||
| 35 | return $this->_currency; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param CurrencyTrait|Record $c |
||
| 40 | */ |
||
| 41 | public function setCurrency(Record $c) |
||
| 42 | { |
||
| 43 | $this->_currency = $c; |
||
| 44 | $this->setCurrencyCode($c->code); |
||
| 45 | } |
||
| 46 | |||
| 47 | public function initCurrency() |
||
| 48 | { |
||
| 49 | $this->_currency = currencyManager()->getByCode($this->getCurrencyCode()); |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @return mixed |
||
| 54 | */ |
||
| 55 | public function getCurrencyAmount() |
||
| 56 | { |
||
| 57 | return $this->amount; |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @param $code |
||
| 62 | * |
||
| 63 | * @return $this |
||
| 64 | */ |
||
| 65 | public function setCurrencyCode($code) |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @return mixed |
||
| 78 | */ |
||
| 79 | public function getCurrencyCode() |
||
| 82 | } |
||
| 83 | } |
||
| 84 |