Completed
Push — master ( c44990...b4ec9a )
by Mikhail
01:07
created

PublicApi   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 78
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getMarkets() 0 4 1
A getCurrencies() 0 4 1
A getTicker() 0 6 1
A getMarketSummaries() 0 4 1
A getMarketSummary() 0 6 1
A getOrderBook() 0 6 1
A getMarketHistory() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace R3bers\BittrexApi\Api;
6
7
use Exception;
8
9
/**
10
 * Class PublicApi
11
 * @package R3bers\BittrexApi\Api
12
 */
13
class PublicApi extends Api
14
{
15
    /**
16
     * @return array
17
     * @throws Exception
18
     */
19
    public function getMarkets(): array
20
    {
21
        return $this->get('/public/getmarkets');
22
    }
23
24
    /**
25
     * @return array
26
     * @throws Exception
27
     */
28
    public function getCurrencies(): array
29
    {
30
        return $this->get('/public/getcurrencies');
31
    }
32
33
    /**
34
     * @param string $market
35
     * @return array
36
     * @throws Exception
37
     */
38
    public function getTicker(string $market): array
39
    {
40
        $parameters = ['market' => $market];
41
42
        return $this->get('/public/getticker', $parameters);
43
    }
44
45
    /**
46
     * @return array
47
     * @throws Exception
48
     */
49
    public function getMarketSummaries(): array
50
    {
51
        return $this->get('/public/getmarketsummaries');
52
    }
53
54
    /**
55
     * @param string $market
56
     * @return array
57
     * @throws Exception
58
     */
59
    public function getMarketSummary(string $market): array
60
    {
61
        $parameters = ['market' => $market];
62
63
        return $this->get('/public/getmarketsummary', $parameters);
64
    }
65
66
    /**
67
     * @param string $market
68
     * @param string $type
69
     * @return array
70
     * @throws Exception
71
     */
72
    public function getOrderBook(string $market, $type = 'both'): array
73
    {
74
        $parameters = ['market' => $market, 'type' => $type];
75
76
        return $this->get('/public/getorderbook', $parameters);
77
    }
78
79
    /**
80
     * @param string $market
81
     * @return array
82
     * @throws Exception
83
     */
84
    public function getMarketHistory(string $market)
85
    {
86
        $parameters = ['market' => $market];
87
88
        return $this->get('/public/getmarkethistory', $parameters);
89
    }
90
}
91