Passed
Push — master ( 8ca73d...2eaf19 )
by Vladislav
02:37 queued 15s
created

KlineResponseItem::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 12
rs 9.9332
1
<?php
2
3
namespace Carpenstar\ByBitAPI\WebSockets\Derivatives\PublicChannels\Kline\Entity;
4
5
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
6
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
7
8
class KlineResponseItem extends AbstractResponse
9
{ 
10
    private \DateTime $candleStart;
11
    private \DateTime $candleEnd;
12
    private string $interval;
13
    private float $open;
14
    private float $close;
15
    private float $high;
16
    private float $low;
17
    private float $volume;
18
    private float $turnover;
19
    private bool $isConfirm;
20
21
    public function __construct(array $data)
22
    {
23
        $this->candleStart = DateTimeHelper::makeFromTimestamp($data['start']);
24
        $this->candleEnd = DateTimeHelper::makeFromTimestamp($data['end']);
25
        $this->interval = $data['interval'];
26
        $this->open = $data['open'];
27
        $this->close = $data['close'];
28
        $this->high = $data['high'];
29
        $this->low = $data['low'];
30
        $this->volume = $data['volume'];
31
        $this->turnover = $data['turnover'];
32
        $this->isConfirm = $data['confirm'];
33
    }
34
35
    public function getCandleStart(): \DateTime
36
    {
37
        return $this->candleStart;
38
    }
39
40
    public function getCandleEnd(): \DateTime
41
    {
42
        return $this->candleEnd;
43
    }
44
45
    public function getInterval(): string
46
    {
47
        return $this->interval;
48
    }
49
50
    public function getOpen(): float
51
    {
52
        return $this->open;
53
    }
54
55
    public function getClose(): float
56
    {
57
        return $this->close;
58
    }
59
60
    public function getHigh(): float
61
    {
62
        return $this->high;
63
    }
64
65
    public function getLow(): float
66
    {
67
        return $this->low;
68
    }
69
70
    public function getVolume(): float
71
    {
72
        return $this->volume;
73
    }
74
75
    public function getTurnover(): float
76
    {
77
        return $this->turnover;
78
    }
79
80
    public function isConfirm(): bool
81
    {
82
        return $this->isConfirm;
83
    }
84
}
85