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

PollAnswer::getUser()   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 0
crap 2
1
<?php
2
3
namespace TelegramBot\Api\Types;
4
5
use TelegramBot\Api\BaseType;
6
7
8
/**
9
 * Class PollAnswerQuery
10
 *
11
 * Poll answer from user
12
 *
13
 * @package TelegramBot\Api\Types
14
 */
15
class PollAnswer extends BaseType
16
{
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @var array
21
     */
22
    static protected $requiredParams = ['poll_id', 'option_ids', 'user'];
23
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * @var array
28
     */
29
    static protected $map = [
30
        'option_ids' => true,
31
        'user' => User::class,
32
        'poll_id' => true,
33
    ];
34
35
36
37
    /**
38
     * Sender
39
     *
40
     * @var \TelegramBot\Api\Types\User
41
     */
42
    protected $user;
43
44
    /**
45
     *
46
     * @var int
47
     */
48
    protected $pollId;
49
50
    /**
51
     * @var int[]
52
     */
53
    protected $optionIds;
54
55
56
    /**
57
     * @return string
58
     */
59
    public function getPollId()
60
    {
61
        return $this->pollId;
62
    }
63
64
    /**
65
     * @param string $id
66
     */
67
    public function setPollId($id)
68
    {
69
        $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...
70
    }
71
72
73
    /**
74
     * @return User
75
     */
76
    public function getUser()
77
    {
78
        return $this->user;
79
    }
80
81
    /**
82
     * @param User $from
83
     */
84
    public function setUser(User $from)
85
    {
86
        $this->user = $from;
87
    }
88
89
    /**
90
     * @return User
91
     */
92
    public function getFrom()
93
    {
94
        return $this->getUser();
95
    }
96
97
    /**
98
     * @param User $from
99
     */
100
    public function setFrom(User $from)
101
    {
102
        return $this->setUser($from);
103
    }
104
105
    /**
106
     * @return int[]
107
     */
108
    public function getOptionIds()
109
    {
110
        return $this->optionIds;
111
    }
112
113
    /**
114
     * @param int[] $optionIds
115
     */
116
    public function setOptionIds( $optionIds)
117
    {
118
        $this->optionIds = $optionIds;
119
    }
120
121
122
}
123