OpenOrders::getUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
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 View Code Duplication
class OpenOrders extends Endpoint
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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/openOrders';
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 ['symbol' => $this->params['symbol']];
42
    }
43
44
    /**
45
     * Map the given array to create a response object.
46
     *
47
     * @param  array  $data
48
     * @return array
49
     */
50
    public function mapResponse(array $data = [])
51
    {
52
        return array_map(function ($item) {
53
            return [
54
                'id' => $item['orderId'],
55
                'symbol' => $item['symbol'],
56
                'side' => strtolower($item['side']),
57
                'type' => strtolower($item['type']),
58
                'status' => strtolower($item['status']),
59
                'price' => $item['price'],
60
                'amount' => $item['origQty'],
61
                'timestamp' => $item['time'],
62
            ];
63
        }, $data);
64
    }
65
}
66