User::getLanguageCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zanzara\Telegram\Type;
6
7
/**
8
 * This object represents a Telegram user or bot.
9
 *
10
 * More on https://core.telegram.org/bots/api#user
11
 */
12
class User implements \JsonSerializable
13
{
14
15
    /**
16
     * Unique identifier for this user or bot
17
     *
18
     * @var int
19
     */
20
    private $id;
21
22
    /**
23
     * True, if this user is a bot
24
     *
25
     * @var bool
26
     */
27
    private $is_bot;
28
29
    /**
30
     * User's or bot's first name
31
     *
32
     * @var string
33
     */
34
    private $first_name;
35
36
    /**
37
     * Optional. User's or bot's last name
38
     *
39
     * @var string|null
40
     */
41
    private $last_name;
42
43
    /**
44
     * Optional. User's or bot's username
45
     *
46
     * @var string|null
47
     */
48
    private $username;
49
50
    /**
51
     * Optional. IETF language tag of the user's language
52
     *
53
     * @var string|null
54
     */
55
    private $language_code;
56
57
    /**
58
     * Optional. True, if the bot can be invited to groups. Returned only in getMe.
59
     *
60
     * @var bool|null
61
     */
62
    private $can_join_groups;
63
64
    /**
65
     * Optional. True, if privacy mode is disabled for the bot. Returned only in getMe.
66
     *
67
     * @var bool|null
68
     */
69
    private $can_read_all_group_messages;
70
71
    /**
72
     * Optional. True, if the bot supports inline queries. Returned only in getMe.
73
     *
74
     * @var bool|null
75
     */
76
    private $supports_inline_queries;
77
78
    /**
79
     * @return int
80
     */
81
    public function getId(): int
82
    {
83
        return $this->id;
84
    }
85
86
    /**
87
     * @param int $id
88
     */
89
    public function setId(int $id): void
90
    {
91
        $this->id = $id;
92
    }
93
94
    /**
95
     * @return bool
96
     */
97
    public function isBot(): bool
98
    {
99
        return $this->is_bot;
100
    }
101
102
    /**
103
     * @param bool $is_bot
104
     */
105
    public function setIsBot(bool $is_bot): void
106
    {
107
        $this->is_bot = $is_bot;
108
    }
109
110
    /**
111
     * @return string
112
     */
113
    public function getFirstName(): string
114
    {
115
        return $this->first_name;
116
    }
117
118
    /**
119
     * @param string $first_name
120
     */
121
    public function setFirstName(string $first_name): void
122
    {
123
        $this->first_name = $first_name;
124
    }
125
126
    /**
127
     * @return string|null
128
     */
129
    public function getLastName(): ?string
130
    {
131
        return $this->last_name;
132
    }
133
134
    /**
135
     * @param string|null $last_name
136
     */
137
    public function setLastName(?string $last_name): void
138
    {
139
        $this->last_name = $last_name;
140
    }
141
142
    /**
143
     * @return string|null
144
     */
145
    public function getUsername(): ?string
146
    {
147
        return $this->username;
148
    }
149
150
    /**
151
     * @param string|null $username
152
     */
153
    public function setUsername(?string $username): void
154
    {
155
        $this->username = $username;
156
    }
157
158
    /**
159
     * @return string|null
160
     */
161
    public function getLanguageCode(): ?string
162
    {
163
        return $this->language_code;
164
    }
165
166
    /**
167
     * @param string|null $language_code
168
     */
169
    public function setLanguageCode(?string $language_code): void
170
    {
171
        $this->language_code = $language_code;
172
    }
173
174
    /**
175
     * @return bool|null
176
     */
177
    public function getCanJoinGroups(): ?bool
178
    {
179
        return $this->can_join_groups;
180
    }
181
182
    /**
183
     * @param bool|null $can_join_groups
184
     */
185
    public function setCanJoinGroups(?bool $can_join_groups): void
186
    {
187
        $this->can_join_groups = $can_join_groups;
188
    }
189
190
    /**
191
     * @return bool|null
192
     */
193
    public function getCanReadAllGroupMessages(): ?bool
194
    {
195
        return $this->can_read_all_group_messages;
196
    }
197
198
    /**
199
     * @param bool|null $can_read_all_group_messages
200
     */
201
    public function setCanReadAllGroupMessages(?bool $can_read_all_group_messages): void
202
    {
203
        $this->can_read_all_group_messages = $can_read_all_group_messages;
204
    }
205
206
    /**
207
     * @return bool|null
208
     */
209
    public function getSupportsInlineQueries(): ?bool
210
    {
211
        return $this->supports_inline_queries;
212
    }
213
214
    /**
215
     * @param bool|null $supports_inline_queries
216
     */
217
    public function setSupportsInlineQueries(?bool $supports_inline_queries): void
218
    {
219
        $this->supports_inline_queries = $supports_inline_queries;
220
    }
221
222
    /**
223
     * @inheritDoc
224
     */
225
    public function jsonSerialize()
226
    {
227
        return [
228
            'id' => $this->id,
229
            'is_bot' => $this->is_bot,
230
            'username' => $this->username,
231
            'first_name' => $this->first_name,
232
            'last_name' => $this->last_name
233
        ];
234
    }
235
236
    public function __toString()
237
    {
238
        return json_encode($this, JSON_PRETTY_PRINT);
239
    }
240
241
}