Passed
Push — master ( d5901e...869fb0 )
by Vladislav
03:02 queued 37s
created

IndexPriceKlineResponse::getStartTime()   A

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 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Carpenstar\ByBitAPI\Derivatives\MarketData\IndexPriceKline\Response;
3
4
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
5
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
6
use Carpenstar\ByBitAPI\Derivatives\MarketData\IndexPriceKline\Interfaces\IIndexPriceKlineResponse;
7
8
class IndexPriceKlineResponse extends AbstractResponse implements IIndexPriceKlineResponse
9
{
10
    /**
11
     * @var \DateTime $start
12
     */
13
    private \DateTime $startTime;
14
15
    /**
16
     * @var float $open
17
     */
18
    private float $open;
19
20
    /**
21
     * @var float $high
22
     */
23
    private float $high;
24
25
    /**
26
     * @var float $low
27
     */
28
    private float $low;
29
30
    /**
31
     * @var float $close
32
     */
33
    private float $close;
34
35
    public function __construct(array $data)
36
    {
37
        $this
38
            ->setStartTime($data[0])
39
            ->setOpen($data[1])
40
            ->setHigh($data[2])
41
            ->setLow($data[3])
42
            ->setClose($data[4]);
43
    }
44
45
    /**
46
     * @param int $startTime
47
     * @return IndexPriceKlineResponse
48
     */
49
    public function setStartTime(int $startTime): self
50
    {
51
        $this->startTime = DateTimeHelper::makeFromTimestamp($startTime);
52
        return $this;
53
    }
54
55
    /**
56
     * @return \DateTime
57
     */
58
    public function getStartTime(): \DateTime
59
    {
60
        return $this->startTime;
61
    }
62
63
    /**
64
     * @param float $open
65
     * @return $this
66
     */
67
    private function setOpen(float $open): self
68
    {
69
        $this->open = $open;
70
        return $this;
71
    }
72
73
    /**
74
     * @return float
75
     */
76
    public function getOpen(): float
77
    {
78
        return $this->open;
79
    }
80
81
    /**
82
     * @param float $high
83
     * @return $this
84
     */
85
    private function setHigh(float $high): self
86
    {
87
        $this->high = $high;
88
        return $this;
89
    }
90
91
    /**
92
     * @return float
93
     */
94
    public function getHigh(): float
95
    {
96
        return $this->high;
97
    }
98
99
    /**
100
     * @param float $low
101
     * @return $this
102
     */
103
    private function setLow(float $low): self
104
    {
105
        $this->low = $low;
106
        return $this;
107
    }
108
109
    /**
110
     * @return float
111
     */
112
    public function getLow(): float
113
    {
114
        return $this->low;
115
    }
116
117
    /**
118
     * @param float $close
119
     * @return $this
120
     */
121
    private function setClose(float $close): self
122
    {
123
        $this->close = $close;
124
        return $this;
125
    }
126
127
    /**
128
     * @return float
129
     */
130
    public function getClose(): float
131
    {
132
        return $this->close;
133
    }
134
}