Balance   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 46
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getUrl() 0 4 1
A getMethod() 0 4 1
A mapResponse() 0 10 1
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