1 | <?php |
||
15 | class Poll extends BaseType implements TypeInterface |
||
16 | { |
||
17 | /** |
||
18 | * {@inheritdoc} |
||
19 | * |
||
20 | * @var array |
||
21 | */ |
||
22 | protected static $requiredParams = [ |
||
23 | 'id', |
||
24 | 'question', |
||
25 | 'options', |
||
26 | 'total_voter_count', |
||
27 | 'is_closed', |
||
28 | 'is_anonymous', |
||
29 | 'type', |
||
30 | 'allows_multiple_answers', |
||
31 | ]; |
||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | protected static $map = [ |
||
39 | 'id' => true, |
||
40 | 'question' => true, |
||
41 | 'options' => ArrayOfPollOption::class, |
||
42 | 'total_voter_count' => true, |
||
43 | 'is_closed' => true, |
||
44 | 'is_anonymous' => true, |
||
45 | 'type' => true, |
||
46 | 'allows_multiple_answers' => true, |
||
47 | 'correct_option_id' => true, |
||
48 | ]; |
||
49 | |||
50 | /** |
||
51 | * Unique poll identifier |
||
52 | * |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $id; |
||
56 | |||
57 | /** |
||
58 | * Poll question, 1-255 characters |
||
59 | * |
||
60 | * @var string |
||
61 | */ |
||
62 | protected $question; |
||
63 | |||
64 | /** |
||
65 | * List of poll options |
||
66 | * Array of \TelegramBot\Api\Types\PollOption |
||
67 | * |
||
68 | * @var array |
||
69 | */ |
||
70 | protected $options; |
||
71 | |||
72 | /** |
||
73 | * Total number of users that voted in the poll |
||
74 | * |
||
75 | * @var int |
||
76 | */ |
||
77 | protected $totalVoterCount; |
||
78 | |||
79 | /** |
||
80 | * True, if the poll is closed |
||
81 | * |
||
82 | * @var boolean |
||
83 | */ |
||
84 | protected $isClosed; |
||
85 | |||
86 | /** |
||
87 | * True, if the poll is anonymous |
||
88 | * |
||
89 | * @var bool |
||
90 | */ |
||
91 | protected $isAnonymous; |
||
92 | |||
93 | /** |
||
94 | * Poll type, currently can be “regular” or “quiz” |
||
95 | * |
||
96 | * @var string |
||
97 | */ |
||
98 | protected $type; |
||
99 | |||
100 | /** |
||
101 | * True, if the poll allows multiple answers |
||
102 | * |
||
103 | * @var bool |
||
104 | */ |
||
105 | protected $allowsMultipleAnswers; |
||
106 | |||
107 | /** |
||
108 | * Optional. 0-based identifier of the correct answer option. |
||
109 | * Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) |
||
110 | * by the bot or to the private chat with the bot. |
||
111 | * |
||
112 | * @var int |
||
113 | */ |
||
114 | protected $correctOptionId; |
||
115 | |||
116 | /** |
||
117 | * @return string |
||
118 | */ |
||
119 | 1 | public function getId() |
|
123 | |||
124 | /** |
||
125 | * @param string $id |
||
126 | */ |
||
127 | 2 | public function setId($id) |
|
131 | |||
132 | /** |
||
133 | * @return string |
||
134 | */ |
||
135 | 1 | public function getQuestion() |
|
139 | |||
140 | /** |
||
141 | * @param string $question |
||
142 | */ |
||
143 | 2 | public function setQuestion($question) |
|
147 | |||
148 | /** |
||
149 | * @return array |
||
150 | */ |
||
151 | 1 | public function getOptions() |
|
155 | |||
156 | /** |
||
157 | * @param array $options |
||
158 | */ |
||
159 | 2 | public function setOptions($options) |
|
163 | |||
164 | /** |
||
165 | * @return int |
||
166 | */ |
||
167 | 1 | public function getTotalVoterCount() |
|
168 | { |
||
169 | 1 | return $this->totalVoterCount; |
|
170 | } |
||
171 | |||
172 | /** |
||
173 | * @param int $totalVoterCount |
||
174 | */ |
||
175 | 2 | public function setTotalVoterCount($totalVoterCount) |
|
179 | |||
180 | /** |
||
181 | * @return bool |
||
182 | */ |
||
183 | 1 | public function isClosed() |
|
187 | |||
188 | /** |
||
189 | * @param bool $isClosed |
||
190 | */ |
||
191 | 2 | public function setIsClosed($isClosed) |
|
195 | |||
196 | /** |
||
197 | * @return bool |
||
198 | */ |
||
199 | 1 | public function isAnonymous() |
|
203 | |||
204 | /** |
||
205 | * @param bool $isAnonymous |
||
206 | */ |
||
207 | 2 | public function setIsAnonymous($isAnonymous) |
|
211 | |||
212 | /** |
||
213 | * @return string |
||
214 | */ |
||
215 | 1 | public function getType() |
|
219 | |||
220 | /** |
||
221 | * @param string $type |
||
222 | */ |
||
223 | 2 | public function setType($type) |
|
227 | |||
228 | /** |
||
229 | * @return bool |
||
230 | */ |
||
231 | 1 | public function isAllowsMultipleAnswers() |
|
235 | |||
236 | /** |
||
237 | * @param bool $allowsMultipleAnswers |
||
238 | */ |
||
239 | 2 | public function setAllowsMultipleAnswers($allowsMultipleAnswers) |
|
243 | |||
244 | /** |
||
245 | * @return int |
||
246 | */ |
||
247 | 1 | public function getCorrectOptionId() |
|
251 | |||
252 | /** |
||
253 | * @param int $correctOptionId |
||
254 | */ |
||
255 | 2 | public function setCorrectOptionId($correctOptionId) |
|
259 | } |
||
260 |