| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 40 | protected function convertCurrency($value, array $field, bool $fromApi) |
||
| 41 | { |
||
| 42 | if ($fromApi) { |
||
| 43 | if ($value) { |
||
| 44 | $currency = \App\Fields\Currency::getIdByCode($value); |
||
| 45 | if (empty($currency)) { |
||
| 46 | $currency = \App\Fields\Currency::addCurrency($value); |
||
| 47 | } |
||
| 48 | } else { |
||
| 49 | $currency = \App\Fields\Currency::getDefault()['id']; |
||
| 50 | } |
||
| 51 | } else { |
||
| 52 | $currency = \App\Fields\Currency::getById($value)['currency_code']; |
||
| 53 | } |
||
| 54 | return $currency; |
||
| 55 | } |
||
| 57 |