Total Complexity | 5 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class Fixer |
||
9 | { |
||
10 | /** |
||
11 | * @var array |
||
12 | */ |
||
13 | private $rates; |
||
14 | |||
15 | /** |
||
16 | * @param string $from |
||
17 | * @param string $to |
||
18 | * @return mixed |
||
19 | * @throws NotFoundException |
||
20 | */ |
||
21 | public function get($from, $to) |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param string $from |
||
34 | */ |
||
35 | private function getRates($from) |
||
36 | { |
||
37 | if (!$this->rates[$from]) { |
||
38 | $response = (new Client())->get("http://api.fixer.io/latest?base={$from}"); |
||
39 | $this->rates[$from] = json_decode($response->getBody(), true)['rates']; |
||
40 | } |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @param string $from |
||
45 | * @param array $rates |
||
46 | */ |
||
47 | public function setRates($from, $rates) |
||
50 | } |
||
51 | } |
||
52 |