Passed
Pull Request — master (#281)
by
unknown
04:29 queued 01:22
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
 * Poll answer from user
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
39
    /**
40
     * Sender
41
     *
42
     * @var \TelegramBot\Api\Types\User
43
     */
44
    protected $user;
45
46
    /**
47
     *
48
     * @var int
49
     */
50
    protected $pollId;
51
52
    /**
53
     * @var int[]
54
     */
55
    protected $optionIds;
56
57
58
    /**
59
     * @return string
60
     */
61
    public function getPollId()
62
    {
63
        return $this->pollId;
64
    }
65
66
    /**
67
     * @param string $id
68
     */
69
    public function setPollId($id)
70
    {
71
        $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...
72
    }
73
74
75
    /**
76
     * @return User
77
     */
78
    public function getUser()
79
    {
80
        return $this->user;
81
    }
82
83
    /**
84
     * @param User $from
85
     */
86
    public function setUser(User $from)
87
    {
88
        $this->user = $from;
89
    }
90
91
    /**
92
     * @return User
93
     */
94
    public function getFrom()
95
    {
96
        return $this->getUser();
97
    }
98
99
    /**
100
     * @param User $from
101
     */
102
    public function setFrom(User $from)
103
    {
104
        return $this->setUser($from);
105
    }
106
107
    /**
108
     * @return int[]
109
     */
110
    public function getOptionIds()
111
    {
112
        return $this->optionIds;
113
    }
114
115
    /**
116
     * @param int[] $optionIds
117
     */
118
    public function setOptionIds( $optionIds)
119
    {
120
        $this->optionIds = $optionIds;
121
    }
122
123
124
}
125