Ticker::getData()   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 Ticker extends Endpoint
6
{
7
    /**
8
     * Get the request url.
9
     *
10
     * @return string
11
     */
12
    public function getUrl()
13
    {
14
        return parent::getUrl().'v1/ticker/24hr';
15
    }
16
17
    /**
18
     * Get the request method.
19
     *
20
     * @return string
21
     */
22
    public function getMethod()
23
    {
24
        return 'GET';
25
    }
26
27
    /**
28
     * Get the request data.
29
     *
30
     * @return array
31
     */
32
    public function getData()
33
    {
34
        return ['symbol' => $this->params['symbol']];
35
    }
36
37
    /**
38
     * Map the given array to create a response object.
39
     *
40
     * @param  array  $data
41
     * @return array
42
     */
43
    public function mapResponse(array $data = [])
44
    {
45
        return [
46
           'low' => $data['lowPrice'],
47
           'high' => $data['highPrice'],
48
           'last' => $data['lastPrice'],
49
           'volume' => $data['volume'],
50
           'open' => $data['openPrice'],
51
           'bid' => $data['bidPrice'],
52
           'ask' => $data['askPrice'],
53
           'average' => $data['weightedAvgPrice'],
54
           'timestamp' => $data['closeTime'],
55
        ];
56
    }
57
}
58