Completed
Push — master ( 91bd85...f52cfe )
by Camilo
02:46
created

Poll::mapSubObjects()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 2
dl 0
loc 9
ccs 0
cts 4
cp 0
crap 6
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace unreal4u\TelegramAPI\Telegram\Types;
6
7
use unreal4u\TelegramAPI\Abstracts\TelegramTypes;
8
use unreal4u\TelegramAPI\Telegram\Types\Custom\PollOptionArray;
9
10
/**
11
 * This object contains information about a poll
12
 *
13
 * Objects defined as-is june 2019
14
 *
15
 * @see https://core.telegram.org/bots/api#poll
16
 */
17
class Poll extends TelegramTypes
18
{
19
    /**
20
     * Unique poll identifier
21
     * @var string
22
     */
23
    public $id;
24
25
    /**
26
     * Poll question, 1-255 characters
27
     * @var string
28
     */
29
    public $question = '';
30
31
    /**
32
     * List of poll options
33
     * @var PollOption[]
34
     */
35
    public $options;
36
37
    /**
38
     * True, if the poll is closed
39
     * @var bool
40
     */
41
    public $is_closed;
42
43
    public function mapSubObjects(string $key, array $data): TelegramTypes
44
    {
45
        switch ($key) {
46
            case 'options':
47
                return new PollOptionArray($data, $this->logger);
48
        }
49
50
        return parent::mapSubObjects($key, $data); // TODO: Change the autogenerated stub
51
    }
52
}
53