Accounts::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace RevolutPHP;
4
5
class Accounts
6
{
7
    const ENDPOINT = 'accounts';
8
9
    /**
10
     * @var Client
11
     */
12
    private $client;
13
14
    /**
15
     * Account 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-accounts
25
     *
26
     * @return mixed
27
     * @throws \GuzzleHttp\Exception\GuzzleException
28
     */
29
    public function all()
30
    {
31
        return $this->client->get(self::ENDPOINT);
32
    }
33
34
    /**
35
     * @see https://revolutdev.github.io/business-api/#get-account
36
     *
37
     * @param string $id
38
     * @return mixed
39
     * @throws \GuzzleHttp\Exception\GuzzleException
40
     */
41
    public function get(string $id)
42
    {
43
        return $this->client->get(self::ENDPOINT.'/'.$id);
44
    }
45
46
    /**
47
     * @see https://revolutdev.github.io/business-api/#get-account-details
48
     *
49
     * @param string $id
50
     * @return mixed
51
     * @throws \GuzzleHttp\Exception\GuzzleException
52
     */
53
    public function getDetails(string $id)
54
    {
55
        return $this->client->get(self::ENDPOINT.'/'.$id.'/bank-details');
56
    }
57
}
58