1 | <?php |
||
5 | class CurrencyConverter |
||
6 | { |
||
7 | private $fromCurrency; |
||
8 | |||
9 | private $toCurrency; |
||
10 | |||
11 | private $apiKey; |
||
12 | |||
13 | private $apiCaller; |
||
14 | |||
15 | private $rates; |
||
16 | |||
17 | 4 | public function __construct(string $apiKey) |
|
23 | |||
24 | 3 | public function convert(string $fromCurrency, string $toCurrency, $amount) :float |
|
33 | |||
34 | 1 | public function getRates(string $fromCurrency, string $toCurrency) :float |
|
35 | { |
||
36 | 1 | return $this->rates->getRates($fromCurrency, $toCurrency); |
|
37 | } |
||
38 | |||
39 | 2 | private function calculateValue($rate, $amount) :float |
|
45 | |||
46 | public function setApiCaller(ApiCaller $apiCaller) |
||
50 | |||
51 | 3 | public function setRates(Rates $rates) |
|
55 | |||
56 | public function getApiCaller() :ApiCaller |
||
60 | } |
||
61 |