1 | <?php |
||
21 | class EcbClient implements EcbClientInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $exchangeRatesUrl; |
||
27 | |||
28 | /** |
||
29 | * @var CacheConfig |
||
30 | */ |
||
31 | private $cacheConfig; |
||
32 | |||
33 | /** |
||
34 | * @var MapperInterface |
||
35 | */ |
||
36 | private $mapper; |
||
37 | |||
38 | /** |
||
39 | * @var Client |
||
40 | */ |
||
41 | private $client; |
||
42 | |||
43 | /** |
||
44 | * EcbClient constructor. |
||
45 | * |
||
46 | * @param string $exchangeRatesUrl |
||
47 | * @param CacheConfig|null $cacheConfig |
||
48 | * @param MapperInterface|null $mapper |
||
49 | */ |
||
50 | public function __construct( |
||
63 | |||
64 | /** |
||
65 | * Get exchange rates. |
||
66 | * |
||
67 | * @return ExchangeRate[] |
||
68 | * @throws \SteffenBrand\CurrCurr\Exception\ExchangeRatesRequestFailedException |
||
69 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
70 | * @throws \Psr\SimpleCache\InvalidArgumentException |
||
71 | */ |
||
72 | public function getExchangeRates(): array |
||
86 | |||
87 | /** |
||
88 | * Perform cached request. |
||
89 | * |
||
90 | * @return \Psr\Http\Message\ResponseInterface |
||
91 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
92 | * @throws \Psr\SimpleCache\InvalidArgumentException |
||
93 | */ |
||
94 | private function performCachedRequest(): ResponseInterface |
||
117 | |||
118 | /** |
||
119 | * Perform request. |
||
120 | * |
||
121 | * @return \Psr\Http\Message\ResponseInterface |
||
122 | * @throws \GuzzleHttp\Exception\GuzzleException |
||
123 | */ |
||
124 | private function performRequest(): ResponseInterface |
||
128 | |||
129 | } |
||
130 |