Test Failed
Push — master ( f1d563...1fab6c )
by Vladislav
10:20 queued 07:53
created

PublicTradingHistoryResponseItem   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 109
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 22
c 1
b 0
f 0
dl 0
loc 109
rs 10
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getSymbol() 0 3 1
A getExecId() 0 3 1
A __construct() 0 9 1
A getTime() 0 3 1
A getPrice() 0 3 1
A isBlockTrade() 0 3 1
A getSize() 0 3 1
A getSide() 0 3 1
1
<?php
2
namespace Carpenstar\ByBitAPI\Derivatives\MarketData\PublicTradingHistory\Response;
3
4
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
5
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
6
use Carpenstar\ByBitAPI\Derivatives\MarketData\PublicTradingHistory\Interfaces\IPublicTradingHistoryResponseItemInterface;
7
8
class PublicTradingHistoryResponseItem extends AbstractResponse implements IPublicTradingHistoryResponseItemInterface
9
{
10
    /**
11
     * Execution id
12
     * @var string $execId
13
     */
14
    private string $execId;
15
16
    /**
17
     * Symbol name
18
     * @var string $symbol
19
     */
20
    private string $symbol;
21
22
    /**
23
     * Trade price
24
     * @var float $price
25
     */
26
    private float $price;
27
28
    /**
29
     * Trade size
30
     * @var float $size
31
     */
32
    private float $size;
33
34
    /**
35
     * Side of taker Buy, Sell
36
     * @var string $side
37
     */
38
    private string $side;
39
40
    /**
41
     * Trade time
42
     * @var \DateTime $time
43
     */
44
    private \DateTime $time;
45
46
    /**
47
     * Is block trade
48
     * @var bool $isBlockTrade
49
     */
50
    private bool $isBlockTrade;
51
52
    public function __construct(array $data)
53
    {
54
        $this->execId = $data['execId'];
55
        $this->symbol = $data['symbol'];
56
        $this->price = $data['price'];
57
        $this->size = $data['size'];
58
        $this->side = $data['side'];
59
        $this->time = DateTimeHelper::makeFromTimestamp($data['time']);
60
        $this->isBlockTrade = $data['isBlockTrade'];
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function getExecId(): string
67
    {
68
        return $this->execId;
69
    }
70
71
    /**
72
     * @return string
73
     */
74
    public function getSymbol(): string
75
    {
76
        return $this->symbol;
77
    }
78
79
    /**
80
     * @return float
81
     */
82
    public function getPrice(): float
83
    {
84
        return $this->price;
85
    }
86
87
    /**
88
     * @return float
89
     */
90
    public function getSize(): float
91
    {
92
        return $this->size;
93
    }
94
95
    /**
96
     * @return string
97
     */
98
    public function getSide(): string
99
    {
100
        return $this->side;
101
    }
102
103
    /**
104
     * @return \DateTime
105
     */
106
    public function getTime(): \DateTime
107
    {
108
        return $this->time;
109
    }
110
111
    /**
112
     * @return bool
113
     */
114
    public function isBlockTrade(): bool
115
    {
116
        return $this->isBlockTrade;
117
    }
118
}