| Total Complexity | 2 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | trait CurrenciesTrait |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @param $from |
||
| 15 | * @param $to |
||
| 16 | * @param $amount |
||
| 17 | * |
||
| 18 | * @return float|int |
||
| 19 | */ |
||
| 20 | public function convert($from, $to, $amount) |
||
| 21 | { |
||
| 22 | $rates['eur'] = '1'; |
||
|
|
|||
| 23 | $rates['bgn'] = '0.5113'; |
||
| 24 | $rates['ron'] = '0.2260'; |
||
| 25 | |||
| 26 | return $amount * $rates[$from] / $rates[$to]; |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param $code |
||
| 31 | * |
||
| 32 | * @return CurrencyTrait |
||
| 33 | */ |
||
| 34 | public function getByCode($code) |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param $id |
||
| 41 | * |
||
| 42 | * @return CurrencyTrait |
||
| 43 | */ |
||
| 44 | abstract public function findOne($id); |
||
| 45 | } |
||
| 46 |