Passed
Pull Request — master (#281)
by
unknown
02:55
created

PollAnswer::setUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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
    static protected $requiredParams = ['poll_id', 'option_ids', 'user'];
25
26
    /**
27
     * {@inheritdoc}
28
     *
29
     * @var array
30
     */
31
    static protected $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 int
44
     */
45
    protected $pollId;
46
47
    /**
48
     * @var int[]
49
     */
50
    protected $optionIds;
51
52
    /**
53
     * @return string
54
     */
55
    public function getPollId()
56
    {
57
        return $this->pollId;
58
    }
59
60
    /**
61
     * @param string $id
62
     */
63
    public function setPollId($id)
64
    {
65
        $this->pollId = $id;
0 ignored issues
show
Documentation Bug introduced by
The property $pollId was declared of type integer, but $id is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
66
    }
67
68
    /**
69
     * @return User
70
     */
71
    public function getUser()
72
    {
73
        return $this->user;
74
    }
75
76
    /**
77
     * @param User $from
78
     */
79
    public function setUser(User $from)
80
    {
81
        $this->user = $from;
82
    }
83
84
    /**
85
     * @return User
86
     */
87
    public function getFrom()
88
    {
89
        return $this->getUser();
90
    }
91
92
    /**
93
     * @param User $from
94
     */
95
    public function setFrom(User $from)
96
    {
97
        return $this->setUser($from);
98
    }
99
100
    /**
101
     * @return int[]
102
     */
103
    public function getOptionIds()
104
    {
105
        return $this->optionIds;
106
    }
107
108
    /**
109
     * @param int[] $optionIds
110
     */
111
    public function setOptionIds( $optionIds)
112
    {
113
        $this->optionIds = $optionIds;
114
    }
115
}
116