Balance::getUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace CryptoMarkets\Binance\Endpoints;
4
5
class Balance extends Endpoint
6
{
7
    /**
8
     * Determine if the request need authorized.
9
     *
10
     * @var bool
11
     */
12
    protected $authorize = true;
13
14
    /**
15
     * Get the request url.
16
     *
17
     * @return string
18
     */
19
    public function getUrl()
20
    {
21
        return parent::getUrl().'v3/account';
22
    }
23
24
    /**
25
     * Get the request method.
26
     *
27
     * @return string
28
     */
29
    public function getMethod()
30
    {
31
        return 'GET';
32
    }
33
34
    /**
35
     * Map the given array to create a response object.
36
     *
37
     * @param  array  $data
38
     * @return array
39
     */
40
    public function mapResponse(array $data = [])
41
    {
42
        return array_map(function ($balance) {
43
            return [
44
                'symbol' => $balance['asset'],
45
                'amount' => $balance['free'],
46
                'locked' => $balance['locked'],
47
            ];
48
        }, $data['balances']);
49
    }
50
}
51