Completed
Push — master ( 1ab7f6...5e4939 )
by Camilo
01:36
created

PollAnswer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 29
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A mapSubObjects() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace unreal4u\TelegramAPI\Telegram\Types;
6
7
use unreal4u\TelegramAPI\Abstracts\TelegramTypes;
8
9
/**
10
 * This object represents an answer of a user in a non-anonymous poll.
11
 *
12
 * Objects defined as-is June 2020, Bot API v4.9
13
 *
14
 * @see https://core.telegram.org/bots/api#pollanswer
15
 */
16
class PollAnswer extends TelegramTypes
17
{
18
    /**
19
     * Unique poll identifier
20
     * @var string
21
     */
22
    public $poll_id;
23
24
    /**
25
     * The user, who changed the answer to the poll
26
     * @var User
27
     */
28
    public $user;
29
30
    /**
31
     * 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.
32
     * @var int[]
33
     */
34
    public $option_ids = [];
35
36
    public function mapSubObjects(string $key, array $data): TelegramTypes
37
    {
38
        switch ($key) {
39
            case 'user':
40
                return new User($data, $this->logger);
41
        }
42
        return parent::mapSubObjects($key, $data);
43
    }
44
}
45