Ticker   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 53
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 4 1
A mapResponse() 0 14 1
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