Passed
Pull Request — master (#412)
by Alexander
01:57
created

PollAnswer::getFrom()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
ccs 1
cts 1
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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
     */
63 1
    public function setPollId($id)
64
    {
65 1
        $this->pollId = $id;
66 1
    }
67
68
    /**
69
     * @return User
70
     */
71 2
    public function getUser()
72
    {
73 2
        return $this->user;
74
    }
75
76
    /**
77
     * @param User $from
78
     */
79 2
    public function setUser(User $from)
80
    {
81 2
        $this->user = $from;
82 2
    }
83
84
    /**
85
     * @deprecated
86
     *
87 1
     * @return User
88
     */
89 1
    public function getFrom()
90
    {
91
        @trigger_error(sprintf('Access user with %s is deprecated, use "%s::getUser" method', __METHOD__, __CLASS__), \E_USER_DEPRECATED);
92
93
        return $this->getUser();
94
    }
95 1
96
    /**
97 1
     * @return int[]
98
     */
99
    public function getOptionIds()
100
    {
101
        return $this->optionIds;
102
    }
103 1
104
    /**
105 1
     * @param int[] $optionIds
106
     */
107
    public function setOptionIds($optionIds)
108
    {
109
        $this->optionIds = $optionIds;
110
    }
111
}
112