Rate   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 4
c 1
b 0
f 0
dl 0
loc 24
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 4 1
1
<?php
2
3
namespace tbclla\Revolut\Resources;
4
5
class Rate extends Resource
6
{
7
    /**
8
     * The enpoint for rate requests
9
     * 
10
     * @var string
11
     */
12
    const ENDPOINT = '/rate';
13
14
    /**
15
     * Get an exchange rate
16
     * 
17
     * @see https://revolut-engineering.github.io/api-docs/business-api/#exchanges-get-exchange-rates Official API documentation
18
     * @param string $from 3-letter ISO base currency
19
     * @param string $to 3-letter ISO target currency
20
     * @param float $amount decimal amount, default is 1.00
21
     * @return array The response body
22
     * @throws \tbclla\Revolut\Exceptions\ApiException if the client responded with a 4xx-5xx response
23
     * @throws \tbclla\Revolut\Exceptions\AppUnauthorizedException if the app needs to be re-authorized
24
     */
25
    public function get(string $from, string $to, float $amount = 1)
26
    {
27
        return $this->client->get(self::ENDPOINT, [
28
            'query' => compact('from', 'to', 'amount')
29
        ]);
30
    }
31
}
32