Account   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 112
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 12
eloc 24
c 1
b 0
f 0
dl 0
loc 112
ccs 31
cts 31
cp 1
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getWithdrawalHistory() 0 9 2
A getBalances() 0 3 1
A getOrder() 0 5 1
A getOrderHistory() 0 9 2
A withdraw() 0 9 2
A getBalance() 0 5 1
A getDepositAddress() 0 5 1
A getDepositHistory() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Codenixsv\BittrexApi\Api;
6
7
use Exception;
8
9
/**
10
 * Class Account
11
 * @package Codenixsv\BittrexApi\Api
12
 */
13
class Account extends Api
14
{
15
    /**
16
     * @return array
17
     * @throws Exception
18
     */
19 1
    public function getBalances(): array
20
    {
21 1
        return $this->get('/account/getbalances');
22
    }
23
24
    /**
25
     * @param string $currency
26
     * @return array
27
     * @throws Exception
28
     */
29 1
    public function getBalance(string $currency): array
30
    {
31 1
        $parameters = ['currency' => $currency];
32
33 1
        return $this->get('/account/getbalance', $parameters);
34
    }
35
36
    /**
37
     * @param string $currency
38
     * @return array
39
     * @throws Exception
40
     */
41 1
    public function getDepositAddress(string $currency): array
42
    {
43 1
        $parameters = ['currency' => $currency];
44
45 1
        return $this->get('/account/getdepositaddress', $parameters);
46
    }
47
48
    /**
49
     * @param string $currency
50
     * @param float $quantity
51
     * @param string $address
52
     * @param string|null $paymentId
53
     * @return array
54
     * @throws Exception
55
     */
56 1
    public function withdraw(string $currency, float $quantity, string $address, ?string $paymentId = null): array
57
    {
58 1
        $parameters = ['currency' => $currency, 'quantity' => (string)$quantity, 'address' => $address];
59
60 1
        if (!is_null($paymentId)) {
61 1
            $parameters['paymentid'] = $paymentId;
62
        }
63
64 1
        return $this->get('/account/withdraw', $parameters);
65
    }
66
67
    /**
68
     * @param string $uuid
69
     * @return array
70
     * @throws Exception
71
     */
72 1
    public function getOrder(string $uuid): array
73
    {
74 1
        $parameters = ['uuid' => $uuid];
75
76 1
        return $this->get('/account/getorder', $parameters);
77
    }
78
79
    /**
80
     * @param string|null $market
81
     * @return array
82
     * @throws Exception
83
     */
84 1
    public function getOrderHistory(?string $market = null): array
85
    {
86 1
        $parameters = [];
87
88 1
        if (!is_null($market)) {
89 1
            $parameters['market'] = $market;
90
        }
91
92 1
        return $this->get('/account/getorderhistory', $parameters);
93
    }
94
95
    /**
96
     * @param string|null $currency
97
     * @return array
98
     * @throws Exception
99
     */
100 1
    public function getWithdrawalHistory(string $currency = null): array
101
    {
102 1
        $parameters = [];
103
104 1
        if (!is_null($currency)) {
105 1
            $parameters['currency'] = $currency;
106
        }
107
108 1
        return $this->get('/account/getwithdrawalhistory', $parameters);
109
    }
110
111
    /**
112
     * @param string|null $currency
113
     * @return array
114
     * @throws Exception
115
     */
116 1
    public function getDepositHistory(?string $currency = null): array
117
    {
118 1
        $parameters = [];
119
120 1
        if (!is_null($currency)) {
121 1
            $parameters['currency'] = $currency;
122
        }
123
124 1
        return $this->get('/account/getdeposithistory', $parameters);
125
    }
126
}
127