Status   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 63
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getUrl() 0 4 1
A getMethod() 0 4 1
A getData() 0 7 1
A mapResponse() 0 14 1
1
<?php
2
3
namespace CryptoMarkets\Binance\Endpoints;
4
5
class Status 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/order';
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
     * Get the request data.
36
     *
37
     * @return array
38
     */
39
    public function getData()
40
    {
41
        return [
42
            'symbol'  => $this->params['symbol'],
43
            'orderId' => $this->params['id'],
44
        ];
45
    }
46
47
    /**
48
     * Map the given array to create a response object.
49
     *
50
     * @param  array  $data
51
     * @return array
52
     */
53
    public function mapResponse(array $data = [])
54
    {
55
        return [
56
            'id' => $data['orderId'],
57
            'symbol' => $data['symbol'],
58
            'side' => strtolower($data['side']),
59
            'type' => strtolower($data['type']),
60
            'status' => strtolower($data['status']),
61
            'price' => $data['price'],
62
            'amount' => $data['origQty'],
63
            'executed' => $data['executedQty'],
64
            'timestamp' => $data['time'],
65
        ];
66
    }
67
}
68