1 | <?php |
||
5 | class CurrencyConverter |
||
6 | { |
||
7 | private $ratesTableFinder; |
||
8 | |||
9 | public function __construct(ExRatesTableFinder $ratesTableFinder) |
||
13 | |||
14 | /** |
||
15 | * Get the average exchange rates |
||
16 | * |
||
17 | * @param \DateTime $pubDate Optional rates table publication date |
||
18 | * |
||
19 | * @return array |
||
20 | * |
||
21 | * @throws \Exception |
||
22 | */ |
||
23 | public function averageExchangeRates(\DateTime $pubDate = null) |
||
28 | |||
29 | /** |
||
30 | * Convert amount from one currency to another |
||
31 | * |
||
32 | * @param string $fromAmount Amount with four digits after decimal point, e.g. '123.0000' |
||
33 | * @param string $fromCurrency E.g. 'USD' or 'EUR' |
||
34 | * @param string $toCurrency E.g. 'USD' or 'EUR' |
||
35 | * @param \DateTime $pubDate Optional rates table publication date |
||
36 | * |
||
37 | * @return array |
||
38 | * |
||
39 | * @throws \Exception |
||
40 | */ |
||
41 | public function convert($fromAmount, $fromCurrency, $toCurrency, \DateTime $pubDate = null) |
||
71 | } |
||
72 |