ChosenInlineResult   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 147
Duplicated Lines 0 %

Test Coverage

Coverage 60%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 10
eloc 23
c 1
b 0
f 1
dl 0
loc 147
ccs 15
cts 25
cp 0.6
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getResultId() 0 3 1
A setFrom() 0 3 1
A setInlineMessageId() 0 3 1
A getQuery() 0 3 1
A setLocation() 0 3 1
A setResultId() 0 3 1
A setQuery() 0 3 1
A getInlineMessageId() 0 3 1
A getFrom() 0 3 1
A getLocation() 0 3 1
1
<?php
2
3
namespace TelegramBot\Api\Types\Inline;
4
5
use TelegramBot\Api\BaseType;
6
use TelegramBot\Api\Types\Location;
7
use TelegramBot\Api\Types\User;
8
9
/**
10
 * Class ChosenInlineResult
11
 * This object represents a result of an inline query that was chosen by the user and sent to their chat partner.
12
 *
13
 * @package TelegramBot\Api\Types
14
 */
15
class ChosenInlineResult extends BaseType
16
{
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @var array
21
     */
22
    protected static $requiredParams = ['result_id', 'from', 'query'];
23
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * @var array
28
     */
29
    protected static $map = [
30
        'result_id' => true,
31
        'from' => User::class,
32
        'location' => Location::class,
33
        'inline_message_id' => true,
34
        'query' => true,
35
    ];
36
37
    /**
38
     * The unique identifier for the result that was chosen.
39
     *
40
     * @var string
41
     */
42
    protected $resultId;
43
44
    /**
45
     * The user that chose the result.
46
     *
47
     * @var User
48
     */
49
    protected $from;
50
51
    /**
52
     * Optional. Sender location, only for bots that require user location
53
     *
54
     * @var Location|null
55
     */
56
    protected $location;
57
58
    /**
59
     * Optional. Identifier of the sent inline message.
60
     * Available only if there is an inline keyboard attached to the message.
61
     * Will be also received in callback queries and can be used to edit the message.
62
     *
63
     * @var string|null
64
     */
65
    protected $inlineMessageId;
66
67
    /**
68
     * The query that was used to obtain the result.
69
     *
70
     * @var string
71
     */
72
    protected $query;
73
74
    /**
75
     * @return string
76
     */
77 2
    public function getResultId()
78
    {
79 2
        return $this->resultId;
80
    }
81
82
    /**
83
     * @param string $resultId
84
     *
85 3
     * @return void
86
     */
87 3
    public function setResultId($resultId)
88 3
    {
89
        $this->resultId = $resultId;
90
    }
91
92
    /**
93 2
     * @return User
94
     */
95 2
    public function getFrom()
96
    {
97
        return $this->from;
98
    }
99
100
    /**
101 3
     * @param User $from
102
     *
103 3
     * @return void
104 3
     */
105
    public function setFrom(User $from)
106
    {
107
        $this->from = $from;
108
    }
109
110
    /**
111
     * @return Location|null
112
     */
113
    public function getLocation()
114
    {
115
        return $this->location;
116
    }
117
118
    /**
119
     * @param Location $location
120
     *
121
     * @return void
122
     */
123
    public function setLocation($location)
124
    {
125
        $this->location = $location;
126
    }
127
128
    /**
129
     * @return null|string
130
     */
131
    public function getInlineMessageId()
132
    {
133
        return $this->inlineMessageId;
134
    }
135
136
    /**
137
     * @param string $inlineMessageId
138
     *
139
     * @return void
140
     */
141 2
    public function setInlineMessageId($inlineMessageId)
142
    {
143 2
        $this->inlineMessageId = $inlineMessageId;
144
    }
145
146
    /**
147
     * @return string
148
     */
149 3
    public function getQuery()
150
    {
151 3
        return $this->query;
152 3
    }
153
154
    /**
155
     * @param string $query
156
     *
157
     * @return void
158
     */
159
    public function setQuery($query)
160
    {
161
        $this->query = $query;
162
    }
163
}
164