7
7
/**
8
8
* Represents the type of a bot API dialog ID.
9
9
*
10
+ * @psalm-immutable
11
+ *
10
12
* @api
11
13
*/
12
14
enum DialogId
@@ -39,6 +41,8 @@ enum DialogId
39
41
/**
40
42
* Get the type of a dialog using just its bot API dialog ID.
41
43
*
44
+ * @psalm-pure
45
+ *
42
46
* @param integer $id Bot API ID.
43
47
*/
44
48
public static function getType (int $ id ): self
@@ -61,6 +65,8 @@ public static function getType(int $id): self
61
65
62
66
/**
63
67
* Checks whether the provided bot API ID is a supergroup or channel ID.
68
+ *
69
+ * @psalm-pure
64
70
*/
65
71
public static function isSupergroupOrChannel (int $ id ): bool
66
72
{
@@ -69,20 +75,26 @@ public static function isSupergroupOrChannel(int $id): bool
69
75
70
76
/**
71
77
* Checks whether the provided bot API ID is a chat ID.
78
+ *
79
+ * @psalm-pure
72
80
*/
73
81
public static function isChat (int $ id ): bool
74
82
{
75
83
return self ::getType ($ id ) === self ::CHAT ;
76
84
}
77
85
/**
78
86
* Checks whether the provided bot API ID is a user ID.
87
+ *
88
+ * @psalm-pure
79
89
*/
80
90
public static function isUser (int $ id ): bool
81
91
{
82
92
return self ::getType ($ id ) === self ::USER ;
83
93
}
84
94
/**
85
95
* Checks whether the provided bot API ID is a secret chat ID.
96
+ *
97
+ * @psalm-pure
86
98
*/
87
99
public static function isSecretChat (int $ id ): bool
88
100
{
@@ -92,6 +104,8 @@ public static function isSecretChat(int $id): bool
92
104
/**
93
105
* Convert MTProto secret chat ID to bot API secret chat ID.
94
106
*
107
+ * @psalm-pure
108
+ *
95
109
* @param int $id MTProto secret chat ID
96
110
*
97
111
* @return int Bot API secret chat ID
@@ -108,6 +122,8 @@ public static function fromSecretChatId(int $id): int
108
122
/**
109
123
* Convert bot API secret chat ID to MTProto secret chat ID.
110
124
*
125
+ * @psalm-pure
126
+ *
111
127
* @param int $id Bot API secret chat ID
112
128
*
113
129
* @return int MTProto secret chat ID
@@ -124,6 +140,8 @@ public static function toSecretChatId(int $id): int
124
140
/**
125
141
* Convert MTProto channel ID to bot API channel ID.
126
142
*
143
+ * @psalm-pure
144
+ *
127
145
* @param int $id MTProto channel ID
128
146
*/
129
147
public static function fromSupergroupOrChannelId (int $ id ): int
@@ -138,6 +156,8 @@ public static function fromSupergroupOrChannelId(int $id): int
138
156
/**
139
157
* Convert bot API channel ID to MTProto channel ID.
140
158
*
159
+ * @psalm-pure
160
+ *
141
161
* @param int $id Bot API channel ID
142
162
*/
143
163
public static function toSupergroupOrChannelId (int $ id ): int
@@ -152,6 +172,8 @@ public static function toSupergroupOrChannelId(int $id): int
152
172
/**
153
173
* Convert MTProto chat ID to bot API chat ID.
154
174
*
175
+ * @psalm-pure
176
+ *
155
177
* @param int $id MTProto chat ID
156
178
*/
157
179
public static function fromChatId (int $ id ): int
@@ -166,6 +188,8 @@ public static function fromChatId(int $id): int
166
188
/**
167
189
* Convert bot API chat ID to MTProto chat ID.
168
190
*
191
+ * @psalm-pure
192
+ *
169
193
* @param int $id Bot API chat ID
170
194
*/
171
195
public static function toChatId (int $ id ): int
@@ -180,6 +204,8 @@ public static function toChatId(int $id): int
180
204
/**
181
205
* Convert MTProto user ID to bot API user ID.
182
206
*
207
+ * @psalm-pure
208
+ *
183
209
* @param int $id MTProto user ID
184
210
*/
185
211
public static function fromUserId (int $ id ): int
@@ -193,6 +219,8 @@ public static function fromUserId(int $id): int
193
219
/**
194
220
* Convert bot API user ID to MTProto user ID.
195
221
*
222
+ * @psalm-pure
223
+ *
196
224
* @param int $id Bot API user ID
197
225
*/
198
226
public static function toUserId (int $ id ): int
0 commit comments