Poll::setIsClosed()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace TelegramBot\Api\Types;
4
5
use TelegramBot\Api\BaseType;
6
use TelegramBot\Api\TypeInterface;
7
8
/**
9
 * Class Poll
10
 * This object contains information about a poll.
11
 *
12
 * @package TelegramBot\Api\Types
13
 */
14
class Poll extends BaseType implements TypeInterface
15
{
16
    /**
17
     * {@inheritdoc}
18
     *
19
     * @var array
20
     */
21
    protected static $requiredParams = [
22
        'id',
23
        'question',
24
        'options',
25
        'total_voter_count',
26
        'is_closed',
27
        'is_anonymous',
28
        'type',
29
        'allows_multiple_answers',
30
    ];
31
32
    /**
33
     * {@inheritdoc}
34
     *
35
     * @var array
36
     */
37
    protected static $map = [
38
        'id' => true,
39
        'question' => true,
40
        'options' => ArrayOfPollOption::class,
41
        'total_voter_count' => true,
42
        'is_closed' => true,
43
        'is_anonymous' => true,
44
        'type' => true,
45
        'allows_multiple_answers' => true,
46
        'correct_option_id' => true,
47
    ];
48
49
    /**
50
     * Unique poll identifier
51
     *
52
     * @var string
53
     */
54
    protected $id;
55
56
    /**
57
     * Poll question, 1-255 characters
58
     *
59
     * @var string
60
     */
61
    protected $question;
62
63
    /**
64
     * List of poll options
65
     * Array of \TelegramBot\Api\Types\PollOption
66
     *
67
     * @var array
68
     */
69
    protected $options;
70
71
    /**
72
     * Total number of users that voted in the poll
73
     *
74
     * @var int
75
     */
76
    protected $totalVoterCount;
77
78
    /**
79
     * True, if the poll is closed
80
     *
81
     * @var bool
82
     */
83
    protected $isClosed;
84
85
    /**
86
     * True, if the poll is anonymous
87
     *
88
     * @var bool
89
     */
90
    protected $isAnonymous;
91
92
    /**
93
     * Poll type, currently can be “regular” or “quiz”
94
     *
95
     * @var string
96
     */
97
    protected $type;
98
99
    /**
100
     * True, if the poll allows multiple answers
101
     *
102
     * @var bool
103
     */
104
    protected $allowsMultipleAnswers;
105
106
    /**
107
     * Optional. 0-based identifier of the correct answer option.
108
     * Available only for polls in the quiz mode, which are closed, or was sent (not forwarded)
109
     * by the bot or to the private chat with the bot.
110
     *
111
     * @var int|null
112
     */
113
    protected $correctOptionId;
114
115
    /**
116
     * @return string
117
     */
118
    public function getId()
119 1
    {
120
        return $this->id;
121 1
    }
122
123
    /**
124
     * @param string $id
125
     * @return void
126
     */
127 2
    public function setId($id)
128
    {
129 2
        $this->id = $id;
130 2
    }
131
132
    /**
133
     * @return string
134
     */
135 1
    public function getQuestion()
136
    {
137 1
        return $this->question;
138
    }
139
140
    /**
141
     * @param string $question
142
     * @return void
143 2
     */
144
    public function setQuestion($question)
145 2
    {
146 2
        $this->question = $question;
147
    }
148
149
    /**
150
     * @return array
151 1
     */
152
    public function getOptions()
153 1
    {
154
        return $this->options;
155
    }
156
157
    /**
158
     * @param array $options
159 2
     * @return void
160
     */
161 2
    public function setOptions($options)
162 2
    {
163
        $this->options = $options;
164
    }
165
166
    /**
167 1
     * @return int
168
     */
169 1
    public function getTotalVoterCount()
170
    {
171
        return $this->totalVoterCount;
172
    }
173
174
    /**
175 2
     * @param int $totalVoterCount
176
     * @return void
177 2
     */
178 2
    public function setTotalVoterCount($totalVoterCount)
179
    {
180
        $this->totalVoterCount = $totalVoterCount;
181
    }
182
183 1
    /**
184
     * @return bool
185 1
     */
186
    public function isClosed()
187
    {
188
        return $this->isClosed;
189
    }
190
191 2
    /**
192
     * @param bool $isClosed
193 2
     * @return void
194 2
     */
195
    public function setIsClosed($isClosed)
196
    {
197
        $this->isClosed = $isClosed;
198
    }
199 1
200
    /**
201 1
     * @return bool
202
     */
203
    public function isAnonymous()
204
    {
205
        return $this->isAnonymous;
206
    }
207 2
208
    /**
209 2
     * @param bool $isAnonymous
210 2
     * @return void
211
     */
212
    public function setIsAnonymous($isAnonymous)
213
    {
214
        $this->isAnonymous = $isAnonymous;
215 1
    }
216
217 1
    /**
218
     * @return string
219
     */
220
    public function getType()
221
    {
222
        return $this->type;
223 2
    }
224
225 2
    /**
226 2
     * @param string $type
227
     * @return void
228
     */
229
    public function setType($type)
230
    {
231 1
        $this->type = $type;
232
    }
233 1
234
    /**
235
     * @return bool
236
     */
237
    public function isAllowsMultipleAnswers()
238
    {
239 2
        return $this->allowsMultipleAnswers;
240
    }
241 2
242 2
    /**
243
     * @param bool $allowsMultipleAnswers
244
     * @return void
245
     */
246
    public function setAllowsMultipleAnswers($allowsMultipleAnswers)
247 1
    {
248
        $this->allowsMultipleAnswers = $allowsMultipleAnswers;
249 1
    }
250
251
    /**
252
     * @return int|null
253
     */
254
    public function getCorrectOptionId()
255 2
    {
256
        return $this->correctOptionId;
257 2
    }
258 2
259
    /**
260
     * @param int $correctOptionId
261
     * @return void
262
     */
263
    public function setCorrectOptionId($correctOptionId)
264
    {
265
        $this->correctOptionId = $correctOptionId;
266
    }
267
}
268