Symbol   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 45
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 16 3
1
<?php
2
3
namespace CryptoMarkets\Binance\Endpoints;
4
5
class Symbol extends Endpoint
6
{
7
    /**
8
     * Get the request url.
9
     *
10
     * @return string
11
     */
12
    public function getUrl()
13
    {
14
        return parent::getUrl().'v1/exchangeInfo';
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
     * Map the given array to create a response object.
29
     *
30
     * @param  array  $data
31
     * @return array
32
     */
33
    public function mapResponse(array $data = [])
34
    {
35
        $output = [];
36
37
        foreach ($data['symbols'] as $symbol) {
38
            if ($symbol['status'] == 'TRADING') {
39
                $output[] = [
40
                    'symbol' => $symbol['symbol'],
41
                    'base' => $symbol['baseAsset'],
42
                    'quote' => $symbol['quoteAsset'],
43
                ];
44
            }
45
        }
46
47
        return $output;
48
    }
49
}
50