1 | <?php |
||
16 | class ExchangeRatesMapper implements MapperInterface |
||
17 | { |
||
18 | /** |
||
19 | * Map exchange rates response. |
||
20 | * |
||
21 | * @param ResponseInterface $response |
||
22 | * @return ExchangeRate[] |
||
23 | * @throws \SteffenBrand\CurrCurr\Exception\ExchangeRatesMappingFailedException |
||
24 | */ |
||
25 | public function map(ResponseInterface $response): array |
||
33 | |||
34 | /** |
||
35 | * Parse body. |
||
36 | * |
||
37 | * @param string $body |
||
38 | * @return SimpleXMLElement |
||
39 | * @throws \SteffenBrand\CurrCurr\Exception\ExchangeRatesMappingFailedException |
||
40 | */ |
||
41 | private function parseBody(string $body): SimpleXMLElement |
||
54 | |||
55 | /** |
||
56 | * Parse date. |
||
57 | * |
||
58 | * @param SimpleXMLElement $xml |
||
59 | * @return \DateTime |
||
60 | * @throws \SteffenBrand\CurrCurr\Exception\ExchangeRatesMappingFailedException |
||
61 | */ |
||
62 | private function parseDate(SimpleXMLElement $xml): \DateTime |
||
72 | |||
73 | /** |
||
74 | * Parse exchange rates. |
||
75 | * |
||
76 | * @param SimpleXMLElement $xml |
||
77 | * @param \DateTime $date |
||
78 | * @return array |
||
79 | */ |
||
80 | private function parseExchangeRates(SimpleXMLElement $xml, \DateTime $date): array |
||
96 | } |