Passed
Pull Request — master (#7)
by
unknown
04:04
created

Rates   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 4 1
A __construct() 0 3 1
1
<?php
2
3
namespace RevolutPHP;
4
5
class Rates
6
{
7
    const ENDPOINT = 'rate';
8
9
    /**
10
     * @var Client
11
     */
12
    private $client;
13
14
    /**
15
     * Rates constructor.
16
     * @param Client $client
17
     */
18
    public function __construct(Client $client)
19
    {
20
        $this->client = $client;
21
    }
22
23
    /**
24
     * @see https://revolutdev.github.io/business-api/#get-exchange-rates
25
     *
26
     * @return mixed
27
     * @throws \GuzzleHttp\Exception\GuzzleException
28
     */
29
    public function get(string $from, string $to, float $amount)
30
    {
31
        $params = ['from' => $from, 'to' => $to, 'amount' => $amount];
32
        return $this->client->get(self::ENDPOINT.'?'.http_build_query($params));
33
    }
34
}
35