Account   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 48
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A details() 0 3 1
A all() 0 3 1
A get() 0 3 1
1
<?php
2
3
namespace tbclla\Revolut\Resources;
4
5
class Account extends Resource
6
{
7
    /**
8
     * The enpoint for account requests
9
     *
10
     * @var string
11
     */
12
    const ENDPOINT = '/accounts';
13
14
    /**
15
     * Get all accounts
16
     * 
17
     * @see https://revolut-engineering.github.io/api-docs/business-api/#accounts-get-accounts Official API documentation
18
     * @return array The response body
19
     * @throws \tbclla\Revolut\Exceptions\ApiException if the client responded with a 4xx-5xx response
20
     * @throws \tbclla\Revolut\Exceptions\AppUnauthorizedException if the app needs to be re-authorized
21
     */
22
    public function all()
23
    {
24
        return $this->client->get(self::ENDPOINT);
25
    }
26
27
    /**
28
     * Get an account by its ID
29
     * 
30
     * @see https://revolut-engineering.github.io/api-docs/business-api/#accounts-get-account Official API documentation
31
     * @param string $id The account ID in UUID format
32
     * @return array The response body
33
     * @throws \tbclla\Revolut\Exceptions\ApiException if the client responded with a 4xx-5xx response
34
     * @throws \tbclla\Revolut\Exceptions\AppUnauthorizedException if the app needs to be re-authorized
35
     */
36
    public function get(string $id)
37
    {
38
        return $this->client->get(self::ENDPOINT . '/' . $id);
39
    }
40
41
    /**
42
     * Get the details of an account by its ID
43
     *
44
     * @see https://revolut-engineering.github.io/api-docs/business-api/#accounts-get-account-details Official API documentation
45
     * @param string $id The account ID in UUID format
46
     * @return array The response body
47
     * @throws \tbclla\Revolut\Exceptions\ApiException if the client responded with a 4xx-5xx response
48
     * @throws \tbclla\Revolut\Exceptions\AppUnauthorizedException if the app needs to be re-authorized
49
     */
50
    public function details(string $id)
51
    {
52
        return $this->client->get(self::ENDPOINT . '/' . $id . '/bank-details');
53
    }
54
}
55