PollAnswer   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 17
c 1
b 0
f 0
dl 0
loc 96
ccs 17
cts 17
cp 1
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getPollId() 0 3 1
A setPollId() 0 3 1
A getUser() 0 3 1
A getOptionIds() 0 3 1
A setOptionIds() 0 3 1
A getFrom() 0 5 1
A setUser() 0 3 1
1
<?php
2
3
namespace TelegramBot\Api\Types;
4
5
use TelegramBot\Api\BaseType;
6
7
/**
8
 * Class PollAnswer
9
 *
10
 * @see https://core.telegram.org/bots/api#pollanswer
11
 *
12
 * This object represents an answer of a user in a non-anonymous poll.
13
 *
14
 *
15
 * @package TelegramBot\Api\Types
16
 */
17
class PollAnswer extends BaseType
18
{
19
    /**
20
     * {@inheritdoc}
21
     *
22
     * @var array
23
     */
24
    protected static $requiredParams = ['poll_id', 'option_ids', 'user'];
25
26
    /**
27
     * {@inheritdoc}
28
     *
29
     * @var array
30
     */
31
    protected static $map = [
32
        'option_ids' => true,
33
        'user' => User::class,
34
        'poll_id' => true,
35
    ];
36
37
    /**
38
     * @var \TelegramBot\Api\Types\User
39
     */
40
    protected $user;
41
42
    /**
43
     * @var string
44
     */
45
    protected $pollId;
46
47
    /**
48
     * @var int[]
49
     */
50
    protected $optionIds;
51
52
    /**
53
     * @return string
54
     */
55 1
    public function getPollId()
56
    {
57 1
        return $this->pollId;
58
    }
59
60
    /**
61
     * @param string $id
62
     * @return void
63 1
     */
64
    public function setPollId($id)
65 1
    {
66 1
        $this->pollId = $id;
67
    }
68
69
    /**
70
     * @return User
71 2
     */
72
    public function getUser()
73 2
    {
74
        return $this->user;
75
    }
76
77
    /**
78
     * @param User $from
79 2
     * @return void
80
     */
81 2
    public function setUser(User $from)
82 2
    {
83
        $this->user = $from;
84
    }
85
86
    /**
87 1
     * @deprecated
88
     *
89 1
     * @return User
90
     */
91
    public function getFrom()
92
    {
93
        @trigger_error(sprintf('Access user with %s is deprecated, use "%s::getUser" method', __METHOD__, __CLASS__), \E_USER_DEPRECATED);
94
95 1
        return $this->getUser();
96
    }
97 1
98
    /**
99
     * @return int[]
100
     */
101
    public function getOptionIds()
102
    {
103 1
        return $this->optionIds;
104
    }
105 1
106
    /**
107
     * @param int[] $optionIds
108
     * @return void
109
     */
110
    public function setOptionIds($optionIds)
111 1
    {
112
        $this->optionIds = $optionIds;
113 1
    }
114
}
115