GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

TradeHistory::setRate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of Poloniex PHP SDK.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @copyright 2017-2018 Chasovskih Grisha <[email protected]>
9
 * @license https://github.com/signulls/poloniex-php-sdk/blob/master/LICENSE MIT
10
 */
11
12
namespace Poloniex\Response\PublicApi;
13
14
use Poloniex\Exception\PoloniexException;
15
use Poloniex\Response\{AbstractResponse, Traits\DateTrait};
16
17
/**
18
 * Class TradeHistory
19
 *
20
 * @author Grisha Chasovskih <[email protected]>
21
 */
22
class TradeHistory extends AbstractResponse
23
{
24
    use DateTrait;
25
26
    public const TYPE_SELL = 'sell';
27
    public const TYPE_BUY = 'buy';
28
29
    private const TYPES = [
30
        self::TYPE_SELL,
31
        self::TYPE_BUY,
32
    ];
33
34
    /**
35
     * Global trade id
36
     * Example: 263017215
37
     *
38
     * @var int
39
     */
40
    public $globalTradeId;
41
42
    /**
43
     * Trade id
44
     * Example: 2909947
45
     *
46
     * @var int
47
     */
48
    public $tradeId;
49
50
    /**
51
     * Example: "sell" or "buy"
52
     *
53
     * @var string
54
     */
55
    public $type;
56
57
    /**
58
     * Example: "0.00000887"
59
     *
60
     * @var float
61
     */
62
    public $rate;
63
64
    /**
65
     * Example: "2565.84864449"
66
     *
67
     * @var float
68
     */
69
    public $amount;
70
71
    /**
72
     * Example: "0.02275907"
73
     *
74
     * @var float
75
     */
76
    public $total;
77
78
    /**
79
     * @internal
80
     * @param string $type
81
     * @throws PoloniexException
82
     */
83
    public function setType(string $type): void
84
    {
85
        if (!\in_array($type, self::TYPES, true)) {
86
            throw new PoloniexException(sprintf('Invalid type %s given', $type));
87
        }
88
89
        $this->type = $type;
90
    }
91
92
    /**
93
     * @internal
94
     * @param int $globalTradeId
95
     */
96
    public function setGlobalTradeId(int $globalTradeId): void
97
    {
98
        $this->globalTradeId = $globalTradeId;
99
    }
100
101
    /**
102
     * @internal
103
     * @param int $tradeId
104
     */
105
    public function setTradeId(int $tradeId): void
106
    {
107
        $this->tradeId = $tradeId;
108
    }
109
110
    /**
111
     * @internal
112
     * @param float $rate
113
     */
114
    public function setRate(float $rate): void
115
    {
116
        $this->rate = $rate;
117
    }
118
119
    /**
120
     * @internal
121
     * @param float $amount
122
     */
123
    public function setAmount(float $amount): void
124
    {
125
        $this->amount = $amount;
126
    }
127
128
    /**
129
     * @internal
130
     * @param float $total
131
     */
132
    public function setTotal(float $total): void
133
    {
134
        $this->total = $total;
135
    }
136
}