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

IndexPriceKlineRequest::setCategory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Carpenstar\ByBitAPI\Derivatives\MarketData\IndexPriceKline\Request;
3
4
use Carpenstar\ByBitAPI\Core\Enums\DerivativesCategoryEnum;
0 ignored issues
show
Bug introduced by
The type Carpenstar\ByBitAPI\Core...DerivativesCategoryEnum was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
use Carpenstar\ByBitAPI\Core\Enums\EnumDerivativesCategory;
6
use Carpenstar\ByBitAPI\Core\Enums\EnumIntervals;
7
use Carpenstar\ByBitAPI\Core\Enums\IntervalEnum;
0 ignored issues
show
Bug introduced by
The type Carpenstar\ByBitAPI\Core\Enums\IntervalEnum was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
9
use Carpenstar\ByBitAPI\Core\Helpers\StringHelper;
10
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters;
11
use Carpenstar\ByBitAPI\Derivatives\MarketData\IndexPriceKline\Interfaces\IIndexPriceKlineRequest;
12
13
class IndexPriceKlineRequest extends AbstractParameters implements IIndexPriceKlineRequest
14
{
15
    /**
16
     * Product type. linear,inverse. Default: linear, but in the response category shows
17
     * @var string $category
18
     */
19
    protected string $category = EnumDerivativesCategory::CATEGORY_PRODUCT_LINEAR;
20
21
    /**
22
     * Symbol name
23
     * @var string $symbol
24
     */
25
    protected string $symbol;
26
27
    /**
28
     * Kline interval. 1 3 5 15 30 60 120 240 360 720 D M W
29
     * @var string $interval
30
     */
31
    protected string $interval = EnumIntervals::MINUTE1;
32
33
    /**
34
     * The start timestamp (ms)
35
     * @var \DateTime $startTime
36
     */
37
    protected \DateTime $startTime;
38
39
    /**
40
     * The end timestamp (ms)
41
     * @var \DateTime $endTime
42
     */
43
    protected \DateTime $endTime;
44
45
    /**
46
     * Limit for data size per page. [1, 200]. Default: 200
47
     * @var int $limit
48
     */
49
    protected int $limit = 200;
50
51
    public function __construct()
52
    {
53
        $this
54
            ->setRequiredField('symbol')
55
            ->setRequiredField('interval')
56
            ->setRequiredField('startTime')
57
            ->setRequiredField('endTime');
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getCategory(): string
64
    {
65
        return $this->category;
66
    }
67
68
    /**
69
     * @param string $symbol
70
     * @return IndexPriceKlineRequest
71
     */
72
    public function setSymbol(string $symbol): self
73
    {
74
        $this->symbol = $symbol;
75
        return $this;
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function getSymbol(): string
82
    {
83
        return $this->symbol;
84
    }
85
86
    /**
87
     * @param string $interval
88
     * @return IndexPriceKlineRequest
89
     */
90
    public function setInterval(string $interval): self
91
    {
92
        $this->interval = StringHelper::clearInterval($interval);
93
        return $this;
94
    }
95
96
    /**
97
     * @return string
98
     */
99
    public function getInterval(): string
100
    {
101
        return $this->interval;
102
    }
103
104
    /**
105
     * @param int $startTime
106
     * @return IndexPriceKlineRequest
107
     */
108
    public function setStartTime(int $startTime): self
109
    {
110
        $this->startTime = DateTimeHelper::makeFromTimestamp($startTime);
111
        return $this;
112
    }
113
114
    /**
115
     * @return \DateTime
116
     */
117
    public function getStartTime(): \DateTime
118
    {
119
        return $this->startTime;
120
    }
121
122
    /**
123
     * @param int $endTime
124
     * @return IndexPriceKlineRequest
125
     */
126
    public function setEndTime(int $endTime): self
127
    {
128
        $this->endTime = DateTimeHelper::makeFromTimestamp($endTime);
129
        return $this;
130
    }
131
132
    /**
133
     * @return \DateTime
134
     */
135
    public function getEndTime(): \DateTime
136
    {
137
        return $this->endTime;
138
    }
139
140
    /**
141
     * @param int $limit
142
     * @return IndexPriceKlineRequest
143
     */
144
    public function setLimit(int $limit): self
145
    {
146
        $this->limit = $limit;
147
        return $this;
148
    }
149
150
    /**
151
     * @return int
152
     */
153
    public function getLimit(): int
154
    {
155
        return $this->limit;
156
    }
157
}