Passed
Push — master ( 38e013...d5901e )
by Vladislav
54s queued 15s
created

MarkPriceKlineRequest::setStartTime()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
namespace Carpenstar\ByBitAPI\Derivatives\MarketData\MarkPriceKline\Request;
3
4
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
5
use Carpenstar\ByBitAPI\Core\Helpers\StringHelper;
6
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters;
7
8
class MarkPriceKlineRequest extends AbstractParameters
9
{
10
    /**
11
     * Product type. linear
12
     * @var string $category
13
     */
14
    protected string $category;
15
16
    /**
17
     * Symbol name
18
     * @var string $symbol
19
     */
20
    protected string $symbol;
21
22
    /**
23
     * Kline interval. 1 3 5 15 30 60 120 240 360 720 D M W
24
     * @var string $interval
25
     */
26
    protected string $interval;
27
28
    /**
29
     * The start timestamp (ms)
30
     * @var \DateTime $startTime
31
     */
32
    protected \DateTime $startTime;
33
34
    /**
35
     * The end timestamp (ms)
36
     * @var \DateTime $endTime
37
     */
38
    protected \DateTime $endTime;
39
40
    /**
41
     * Limit for data size per page. [1, 200]. Default: 200
42
     * @var int $limit
43
     */
44
    protected int $limit = 200;
45
46
    public function __construct()
47
    {
48
        $this
49
            ->setRequiredField('symbol')
50
            ->setRequiredField('interval')
51
            ->setRequiredField('startTime')
52
            ->setRequiredField('endTime');
53
    }
54
55
    /**
56
     * @param string $category
57
     * @return MarkPriceKlineRequest
58
     */
59
    public function setCategory(string $category): self
0 ignored issues
show
Unused Code introduced by
The parameter $category is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

59
    public function setCategory(/** @scrutinizer ignore-unused */ string $category): self

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
60
    {
61
        $this->category = "linear"; // supports only linear category
62
        return $this;
63
    }
64
65
    /**
66
     * @return string
67
     */
68
    public function getCategory(): string
69
    {
70
        return $this->category;
71
    }
72
73
    /**
74
     * @param string $symbol
75
     * @return MarkPriceKlineRequest
76
     */
77
    public function setSymbol(string $symbol): self
78
    {
79
        $this->symbol = $symbol;
80
        return $this;
81
    }
82
83
    /**
84
     * @return string
85
     */
86
    public function getSymbol(): string
87
    {
88
        return $this->symbol;
89
    }
90
91
    /**
92
     * @param string $interval
93
     * @return MarkPriceKlineRequest
94
     */
95
    public function setInterval(string $interval): self
96
    {
97
        $this->interval = StringHelper::clearInterval($interval);
98
        return $this;
99
    }
100
101
    /**
102
     * @return string
103
     */
104
    public function getInterval(): string
105
    {
106
        return $this->interval;
107
    }
108
109
    /**
110
     * @param int $startTime
111
     * @return MarkPriceKlineRequest
112
     */
113
    public function setStartTime(int $startTime): self
114
    {
115
        $this->startTime = DateTimeHelper::makeFromTimestamp($startTime);
116
        return $this;
117
    }
118
119
    /**
120
     * @return \DateTime
121
     */
122
    public function getStartTime(): \DateTime
123
    {
124
        return $this->startTime;
125
    }
126
127
    /**
128
     * @param int $endTime
129
     * @return MarkPriceKlineRequest
130
     */
131
    public function setEndTime(int $endTime): self
132
    {
133
        $this->endTime = DateTimeHelper::makeFromTimestamp($endTime);
134
        return $this;
135
    }
136
137
    /**
138
     * @return \DateTime
139
     */
140
    public function getEndTime(): \DateTime
141
    {
142
        return $this->endTime;
143
    }
144
145
    /**
146
     * @param int $limit
147
     * @return MarkPriceKlineRequest
148
     */
149
    public function setLimit(int $limit): self
150
    {
151
        $this->limit = $limit;
152
        return $this;
153
    }
154
155
    /**
156
     * @return int
157
     */
158
    public function getLimit(): int
159
    {
160
        return $this->limit;
161
    }
162
}