Poll   A
last analyzed

Complexity

Total Complexity 26

Size/Duplication

Total Lines 302
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 40
dl 0
loc 302
rs 10
c 2
b 0
f 0
wmc 26

26 Methods

Rating   Name   Duplication   Size   Complexity  
A setTotalVoterCount() 0 3 1
A getQuestion() 0 3 1
A getCloseDate() 0 3 1
A setType() 0 3 1
A setAllowsMultipleAnswers() 0 3 1
A setExplanation() 0 3 1
A getCorrectOptionId() 0 3 1
A setIsClosed() 0 3 1
A setOpenPeriod() 0 3 1
A getExplanation() 0 3 1
A getTotalVoterCount() 0 3 1
A setExplanationEntities() 0 3 1
A getId() 0 3 1
A getType() 0 3 1
A setCloseDate() 0 3 1
A getOptions() 0 3 1
A isAnonymous() 0 3 1
A getExplanationEntities() 0 3 1
A isClosed() 0 3 1
A setId() 0 3 1
A setQuestion() 0 3 1
A setIsAnonymous() 0 3 1
A getOpenPeriod() 0 3 1
A setOptions() 0 3 1
A setCorrectOptionId() 0 3 1
A isAllowsMultipleAnswers() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zanzara\Telegram\Type\Poll;
6
7
/**
8
 * This object contains information about a poll.
9
 *
10
 * More on https://core.telegram.org/bots/api#poll
11
 */
12
class Poll
13
{
14
15
    /**
16
     * Unique poll identifier
17
     *
18
     * @var string
19
     */
20
    private $id;
21
22
    /**
23
     * Poll question, 1-255 characters
24
     *
25
     * @var string
26
     */
27
    private $question;
28
29
    /**
30
     * List of poll options
31
     *
32
     * @var PollOption[]
33
     */
34
    private $options;
35
36
    /**
37
     * Total number of users that voted in the poll
38
     *
39
     * @var int
40
     */
41
    private $total_voter_count;
42
43
    /**
44
     * True, if the poll is closed
45
     *
46
     * @var bool
47
     */
48
    private $is_closed;
49
50
    /**
51
     * True, if the poll is anonymous
52
     *
53
     * @var bool
54
     */
55
    private $is_anonymous;
56
57
    /**
58
     * Poll type, currently can be "regular" or "quiz"
59
     *
60
     * @var string
61
     */
62
    private $type;
63
64
    /**
65
     * True, if the poll allows multiple answers
66
     *
67
     * @var bool
68
     */
69
    private $allows_multiple_answers;
70
71
    /**
72
     * Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are
73
     * closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
74
     *
75
     * @var int|null
76
     */
77
    private $correct_option_id;
78
79
    /**
80
     * Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style
81
     * poll, 0-200 characters
82
     *
83
     * @var string|null
84
     */
85
    private $explanation;
86
87
    /**
88
     * Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation.
89
     *
90
     * @var \Zanzara\Telegram\Type\MessageEntity[]|null
91
     */
92
    private $explanation_entities;
93
94
    /**
95
     * Optional. Amount of time in seconds the poll will be active after creation.
96
     *
97
     * @var int|null
98
     */
99
    private $open_period;
100
101
    /**
102
     * Optional. Point in time (Unix timestamp) when the poll will be automatically closed.
103
     *
104
     * @var int|null
105
     */
106
    private $close_date;
107
108
    /**
109
     * @return string
110
     */
111
    public function getId(): string
112
    {
113
        return $this->id;
114
    }
115
116
    /**
117
     * @param string $id
118
     */
119
    public function setId(string $id): void
120
    {
121
        $this->id = $id;
122
    }
123
124
    /**
125
     * @return string
126
     */
127
    public function getQuestion(): string
128
    {
129
        return $this->question;
130
    }
131
132
    /**
133
     * @param string $question
134
     */
135
    public function setQuestion(string $question): void
136
    {
137
        $this->question = $question;
138
    }
139
140
    /**
141
     * @return PollOption[]
142
     */
143
    public function getOptions(): array
144
    {
145
        return $this->options;
146
    }
147
148
    /**
149
     * @param PollOption[] $options
150
     */
151
    public function setOptions(array $options): void
152
    {
153
        $this->options = $options;
154
    }
155
156
    /**
157
     * @return int
158
     */
159
    public function getTotalVoterCount(): int
160
    {
161
        return $this->total_voter_count;
162
    }
163
164
    /**
165
     * @param int $total_voter_count
166
     */
167
    public function setTotalVoterCount(int $total_voter_count): void
168
    {
169
        $this->total_voter_count = $total_voter_count;
170
    }
171
172
    /**
173
     * @return bool
174
     */
175
    public function isClosed(): bool
176
    {
177
        return $this->is_closed;
178
    }
179
180
    /**
181
     * @param bool $is_closed
182
     */
183
    public function setIsClosed(bool $is_closed): void
184
    {
185
        $this->is_closed = $is_closed;
186
    }
187
188
    /**
189
     * @return bool
190
     */
191
    public function isAnonymous(): bool
192
    {
193
        return $this->is_anonymous;
194
    }
195
196
    /**
197
     * @param bool $is_anonymous
198
     */
199
    public function setIsAnonymous(bool $is_anonymous): void
200
    {
201
        $this->is_anonymous = $is_anonymous;
202
    }
203
204
    /**
205
     * @return string
206
     */
207
    public function getType(): string
208
    {
209
        return $this->type;
210
    }
211
212
    /**
213
     * @param string $type
214
     */
215
    public function setType(string $type): void
216
    {
217
        $this->type = $type;
218
    }
219
220
    /**
221
     * @return bool
222
     */
223
    public function isAllowsMultipleAnswers(): bool
224
    {
225
        return $this->allows_multiple_answers;
226
    }
227
228
    /**
229
     * @param bool $allows_multiple_answers
230
     */
231
    public function setAllowsMultipleAnswers(bool $allows_multiple_answers): void
232
    {
233
        $this->allows_multiple_answers = $allows_multiple_answers;
234
    }
235
236
    /**
237
     * @return int|null
238
     */
239
    public function getCorrectOptionId(): ?int
240
    {
241
        return $this->correct_option_id;
242
    }
243
244
    /**
245
     * @param int|null $correct_option_id
246
     */
247
    public function setCorrectOptionId(?int $correct_option_id): void
248
    {
249
        $this->correct_option_id = $correct_option_id;
250
    }
251
252
    /**
253
     * @return string|null
254
     */
255
    public function getExplanation(): ?string
256
    {
257
        return $this->explanation;
258
    }
259
260
    /**
261
     * @param string|null $explanation
262
     */
263
    public function setExplanation(?string $explanation): void
264
    {
265
        $this->explanation = $explanation;
266
    }
267
268
    /**
269
     * @return \Zanzara\Telegram\Type\MessageEntity[]|null
270
     */
271
    public function getExplanationEntities(): ?array
272
    {
273
        return $this->explanation_entities;
274
    }
275
276
    /**
277
     * @param \Zanzara\Telegram\Type\MessageEntity[]|null $explanation_entities
278
     */
279
    public function setExplanationEntities(?array $explanation_entities): void
280
    {
281
        $this->explanation_entities = $explanation_entities;
282
    }
283
284
    /**
285
     * @return int|null
286
     */
287
    public function getOpenPeriod(): ?int
288
    {
289
        return $this->open_period;
290
    }
291
292
    /**
293
     * @param int|null $open_period
294
     */
295
    public function setOpenPeriod(?int $open_period): void
296
    {
297
        $this->open_period = $open_period;
298
    }
299
300
    /**
301
     * @return int|null
302
     */
303
    public function getCloseDate(): ?int
304
    {
305
        return $this->close_date;
306
    }
307
308
    /**
309
     * @param int|null $close_date
310
     */
311
    public function setCloseDate(?int $close_date): void
312
    {
313
        $this->close_date = $close_date;
314
    }
315
316
}