Passed
Push — main ( e0778d...2e4cb3 )
by Miaad
10:42
created
src/settings/easySettings.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      *
12 12
      * @return $this
13 13
      */
14
-    public function setToken (string $token): self {
14
+    public function setToken(string $token): self {
15 15
         $this->settings['token'] = $token;
16 16
         return $this;
17 17
     }
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      *
22 22
      * @return $this
23 23
      */
24
-    public function setName (string $name): self {
24
+    public function setName(string $name): self {
25 25
         $this->settings['name'] = $name;
26 26
         return $this;
27 27
     }
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      *
32 32
      * @return $this
33 33
      */
34
-    public function setLogger (bool $logger): self {
34
+    public function setLogger(bool $logger): self {
35 35
         $this->settings['logger'] = $logger;
36 36
         return $this;
37 37
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      *
42 42
      * @return $this
43 43
      */
44
-    public function setLogSize (int $log_size): self {
44
+    public function setLogSize(int $log_size): self {
45 45
         $this->settings['log_size'] = $log_size;
46 46
         return $this;
47 47
     }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      *
52 52
      * @return $this
53 53
      */
54
-    public function setCertificate (string|CURLFile $certificate): self {
54
+    public function setCertificate(string | CURLFile $certificate): self {
55 55
         $this->settings['certificate'] = $certificate;
56 56
         return $this;
57 57
     }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      *
62 62
      * @return $this
63 63
      */
64
-    public function setHandler (bool $handler): self {
64
+    public function setHandler(bool $handler): self {
65 65
         $this->settings['handler'] = $handler;
66 66
         return $this;
67 67
     }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      *
72 72
      * @return $this
73 73
      */
74
-    public function setSecurity (bool $security): self {
74
+    public function setSecurity(bool $security): self {
75 75
         $this->settings['security'] = $security;
76 76
         return $this;
77 77
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      *
82 82
      * @return $this
83 83
      */
84
-    public function setSecureFolder (bool $secure_folder): self {
84
+    public function setSecureFolder(bool $secure_folder): self {
85 85
         $this->settings['secure_folder'] = $secure_folder;
86 86
         return $this;
87 87
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      *
92 92
      * @return $this
93 93
      */
94
-    public function setMulti (bool $multi): self {
94
+    public function setMulti(bool $multi): self {
95 95
         $this->settings['multi'] = $multi;
96 96
         return $this;
97 97
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      *
102 102
      * @return $this
103 103
      */
104
-    public function setTelegramVerify (bool $telegram_verify): self {
104
+    public function setTelegramVerify(bool $telegram_verify): self {
105 105
         $this->settings['telegram_verify'] = $telegram_verify;
106 106
         return $this;
107 107
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      *
112 112
      * @return $this
113 113
      */
114
-    public function setCloudflareVerify (bool $cloudflare_verify): self {
114
+    public function setCloudflareVerify(bool $cloudflare_verify): self {
115 115
         $this->settings['cloudflare_verify'] = $cloudflare_verify;
116 116
         return $this;
117 117
     }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      *
122 122
      * @return $this
123 123
      */
124
-    public function setArvancloudVerify (bool $arvancloud_verify): self {
124
+    public function setArvancloudVerify(bool $arvancloud_verify): self {
125 125
         $this->settings['arvancloud_verify'] = $arvancloud_verify;
126 126
         return $this;
127 127
     }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      *
132 132
      * @return $this
133 133
      */
134
-    public function setSkipOldUpdates (bool $skip_old_updates): self {
134
+    public function setSkipOldUpdates(bool $skip_old_updates): self {
135 135
         $this->settings['skip_old_updates'] = $skip_old_updates;
136 136
         return $this;
137 137
     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      *
142 142
      * @return $this
143 143
      */
144
-    public function setSecret (string $secret): self {
144
+    public function setSecret(string $secret): self {
145 145
         $this->settings['secret'] = $secret;
146 146
         return $this;
147 147
     }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      *
152 152
      * @return $this
153 153
      */
154
-    public function setMaxConnection (int $max_connection): self {
154
+    public function setMaxConnection(int $max_connection): self {
155 155
         $this->settings['max_connection'] = $max_connection;
156 156
         return $this;
157 157
     }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      *
162 162
      * @return $this
163 163
      */
164
-    public function setBaseUrl (string $base_url): self {
164
+    public function setBaseUrl(string $base_url): self {
165 165
         $this->settings['base_url'] = $base_url;
166 166
         return $this;
167 167
     }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      *
172 172
      * @return $this
173 173
      */
174
-    public function setDownUrl (string $down_url): self {
174
+    public function setDownUrl(string $down_url): self {
175 175
         $this->settings['down_url'] = $down_url;
176 176
         return $this;
177 177
     }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      *
182 182
      * @return $this
183 183
      */
184
-    public function setDefaultParseMode (string $default_parse_mode): self {
184
+    public function setDefaultParseMode(string $default_parse_mode): self {
185 185
         $this->settings['default_parse_mode'] = $default_parse_mode;
186 186
         return $this;
187 187
     }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      *
192 192
      * @return $this
193 193
      */
194
-    public function setDefaultProtectContent (bool $default_protect_content): self {
194
+    public function setDefaultProtectContent(bool $default_protect_content): self {
195 195
         $this->settings['default_protect_content'] = $default_protect_content;
196 196
         return $this;
197 197
     }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      *
202 202
      * @return $this
203 203
      */
204
-    public function setIgnoreUpdatesOlderThen (int $ignore_updates_older_then): self {
204
+    public function setIgnoreUpdatesOlderThen(int $ignore_updates_older_then): self {
205 205
         $this->settings['ignore_updates_older_then'] = $ignore_updates_older_then;
206 206
         return $this;
207 207
     }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      *
212 212
      * @return $this
213 213
      */
214
-    public function setForgotTime (int $forgot_time): self {
214
+    public function setForgotTime(int $forgot_time): self {
215 215
         $this->settings['forgot_time'] = $forgot_time;
216 216
         return $this;
217 217
     }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      *
222 222
      * @return $this
223 223
      */
224
-    public function setBaseTimeout (int $base_timeout): self {
224
+    public function setBaseTimeout(int $base_timeout): self {
225 225
         $this->settings['base_timeout'] = $base_timeout;
226 226
         return $this;
227 227
     }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      *
232 232
      * @return $this
233 233
      */
234
-    public function setReceiver (string|null $receiver): self {
234
+    public function setReceiver(string | null $receiver): self {
235 235
         $this->settings['receiver'] = $receiver;
236 236
         return $this;
237 237
     }
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      *
242 242
      * @return $this
243 243
      */
244
-    public function setAllowedUpdates (array $allowed_updates): self {
244
+    public function setAllowedUpdates(array $allowed_updates): self {
245 245
         $this->settings['allowed_updates'] = $allowed_updates;
246 246
         return $this;
247 247
     }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      *
252 252
      * @return $this
253 253
      */
254
-    public function setUseTypesClasses (bool $use_types_classes): self {
254
+    public function setUseTypesClasses(bool $use_types_classes): self {
255 255
         $this->settings['use_types_classes'] = $use_types_classes;
256 256
         return $this;
257 257
     }
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
      *
262 262
      * @return $this
263 263
      */
264
-    public function setDB (array|easySQL|easyJson|null $db): self {
264
+    public function setDB(array | easySQL | easyJson | null $db): self {
265 265
         if (!is_array($db) && !empty($db)) {
266 266
             $db = $db->getSettings();
267 267
         }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
      *
275 275
      * @return $this
276 276
      */
277
-    public function setPay (array|easyPay $pay): self {
277
+    public function setPay(array | easyPay $pay): self {
278 278
         if (!is_array($pay)) {
279 279
             $pay = $pay->getSettings();
280 280
         }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
     /**
286 286
      * @return array
287 287
      */
288
-    public function getSettings (): array {
288
+    public function getSettings(): array {
289 289
         return $this->settings;
290 290
     }
291 291
 }
292 292
\ No newline at end of file
Please login to merge, or discard this patch.
src/database/json.php 2 patches
Braces   +43 added lines, -56 removed lines patch added patch discarded remove patch
@@ -195,17 +195,13 @@  discard block
 block discarded – undo
195 195
     public static function process (): void {
196 196
         if (isset(BPT::$update->message)) {
197 197
             self::processMessage(BPT::$update->message);
198
-        }
199
-        elseif (isset(BPT::$update->edited_message)) {
198
+        } elseif (isset(BPT::$update->edited_message)) {
200 199
             self::processMessage(BPT::$update->edited_message);
201
-        }
202
-        elseif (isset(BPT::$update->callback_query)) {
200
+        } elseif (isset(BPT::$update->callback_query)) {
203 201
             self::processCallbackQuery(BPT::$update->callback_query);
204
-        }
205
-        elseif (isset(BPT::$update->inline_query)) {
202
+        } elseif (isset(BPT::$update->inline_query)) {
206 203
             self::processInlineQuery(BPT::$update->inline_query);
207
-        }
208
-        elseif (isset(BPT::$update->chat_member)) {
204
+        } elseif (isset(BPT::$update->chat_member)) {
209 205
             self::processChatMember(BPT::$update->chat_member);
210 206
         }
211 207
     }
@@ -230,8 +226,7 @@  discard block
 block discarded – undo
230 226
             if (empty(self::$group)) {
231 227
                 $category = 'supergroups';
232 228
                 $group_id = self::$supergroup_id;
233
-            }
234
-            else {
229
+            } else {
235 230
                 $category = 'groups';
236 231
                 $group_id = self::$group_id;
237 232
             }
@@ -247,8 +242,7 @@  discard block
 block discarded – undo
247 242
             if (empty(self::$group)) {
248 243
                 $category = 'supergroups';
249 244
                 $group_id = self::$supergroup_id;
250
-            }
251
-            else {
245
+            } else {
252 246
                 $category = 'groups';
253 247
                 $group_id = self::$group_id;
254 248
             }
@@ -265,8 +259,7 @@  discard block
 block discarded – undo
265 259
                 self::$user = self::read($category . '/' . self::$user_id);
266 260
                 self::$old_user = clone self::$user;
267 261
                 self::$user->last_active = time();
268
-            }
269
-            else {
262
+            } else {
270 263
                 self::$ids[$category][] = self::$user_id;
271 264
                 self::$user = (object) self::$user_default_data;
272 265
                 self::$user->first_active = self::$user->last_active = time();
@@ -279,19 +272,16 @@  discard block
 block discarded – undo
279 272
                     }
280 273
                 }
281 274
             }
282
-        }
283
-        elseif ($type === chatType::CHANNEL) {
275
+        } elseif ($type === chatType::CHANNEL) {
284 276
             self::$channel_id = $update->chat->id;
285 277
             if (in_array(self::$channel_id,self::$ids[$category])) {
286 278
                 self::$channel = self::read($category . '/' . self::$channel_id);
287 279
                 self::$old_channel = clone self::$channel;
288
-            }
289
-            else {
280
+            } else {
290 281
                 self::$ids[$category][] = self::$channel_id;
291 282
                 self::$channel = (object) self::$channel_default_data;
292 283
             }
293
-        }
294
-        else {
284
+        } else {
295 285
             self::$user_id = $update->from->id;
296 286
             self::$group_user_id = self::$user_id;
297 287
             $chat_id = $update->chat->id;
@@ -302,22 +292,19 @@  discard block
 block discarded – undo
302 292
                     self::$old_supergroup = clone self::$supergroup;
303 293
                     self::$group_ids = self::read($category . '/' . $chat_id . '/users');
304 294
                     self::$old_group_ids = clone self::$group_ids;
305
-                }
306
-                else {
295
+                } else {
307 296
                     self::$ids[$category][] = $chat_id;
308 297
                     self::$supergroup = (object) self::$supergroup_default_data;
309 298
                     self::$group_ids = [];
310 299
                 }
311
-            }
312
-            else {
300
+            } else {
313 301
                 self::$group_id = $update->chat->id;
314 302
                 if (in_array($chat_id,self::$ids[$category])) {
315 303
                     self::$group = self::read($category . '/' . $chat_id);
316 304
                     self::$old_group = clone self::$group;
317 305
                     self::$group_ids = self::read($category . '/' . $chat_id . '/users');
318 306
                     self::$old_group_ids = clone self::$group_ids;
319
-                }
320
-                else {
307
+                } else {
321 308
                     self::$ids[$category][] = $chat_id;
322 309
                     self::$group = (object) self::$group_default_data;
323 310
                     self::$group_ids = [];
@@ -327,15 +314,16 @@  discard block
 block discarded – undo
327 314
             if (in_array(self::$user_id,self::$group_ids)) {
328 315
                 self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$user_id);
329 316
                 self::$old_group_user = clone self::$group_user;
330
-            }
331
-            else {
317
+            } else {
332 318
                 self::$group_ids[] = self::$user_id;
333 319
                 self::$group_user = (object) self::$group_user_default_data;
334 320
             }
335 321
 
336 322
             self::$user = self::read($category.'/'.self::$user_id);
337 323
             self::$old_user = clone self::$user;
338
-            if (!empty(self::$user)) self::$user->last_active = time();
324
+            if (!empty(self::$user)) {
325
+                self::$user->last_active = time();
326
+            }
339 327
         }
340 328
     }
341 329
 
@@ -349,15 +337,13 @@  discard block
 block discarded – undo
349 337
                 self::$old_user = clone self::$user;
350 338
                 self::$user->last_active = time();
351 339
             }
352
-        }
353
-        elseif ($type === chatType::CHANNEL) {
340
+        } elseif ($type === chatType::CHANNEL) {
354 341
             self::$channel_id = $update->message->chat->id;
355 342
             if (in_array(self::$channel_id,self::$ids[$category])) {
356 343
                 self::$channel = self::read($category . '/' . self::$channel_id);
357 344
                 self::$old_channel = clone self::$channel;
358 345
             }
359
-        }
360
-        else {
346
+        } else {
361 347
             self::$user_id = $update->from->id;
362 348
             $chat_id = $update->message->chat->id;
363 349
             if (in_array($chat_id,self::$ids[$category])) {
@@ -365,8 +351,7 @@  discard block
 block discarded – undo
365 351
                     self::$supergroup_id = $update->message->chat->id;
366 352
                     self::$supergroup = self::read($category . '/' . $chat_id);
367 353
                     self::$old_supergroup = clone self::$supergroup;
368
-                }
369
-                else {
354
+                } else {
370 355
                     self::$group_id = $update->message->chat->id;
371 356
                     self::$group = self::read($category . '/' . $chat_id);
372 357
                     self::$old_group = clone self::$group;
@@ -383,7 +368,9 @@  discard block
 block discarded – undo
383 368
 
384 369
             self::$user = self::read($category.'/'.self::$user_id);
385 370
             self::$old_user = clone self::$user;
386
-            if (!empty(self::$user)) self::$user->last_active = time();
371
+            if (!empty(self::$user)) {
372
+                self::$user->last_active = time();
373
+            }
387 374
         }
388 375
     }
389 376
 
@@ -409,13 +396,11 @@  discard block
 block discarded – undo
409 396
             if (in_array(self::$channel_id,self::$ids[$category])) {
410 397
                 self::$channel = self::read($category . '/' . self::$channel_id);
411 398
                 self::$old_channel = clone self::$channel;
412
-            }
413
-            else {
399
+            } else {
414 400
                 self::$ids[$category][] = self::$channel_id;
415 401
                 self::$channel = (object) self::$channel_default_data;
416 402
             }
417
-        }
418
-        else {
403
+        } else {
419 404
             $chat_id = $update->chat->id;
420 405
             $by_id = $update->from->id;
421 406
             $old_user = $update->old_chat_member;
@@ -431,22 +416,19 @@  discard block
 block discarded – undo
431 416
                     self::$old_supergroup = clone self::$supergroup;
432 417
                     self::$group_ids = self::read($category . '/' . $chat_id . '/users');
433 418
                     self::$old_group_ids = clone self::$group_ids;
434
-                }
435
-                else {
419
+                } else {
436 420
                     self::$ids[$category][] = $chat_id;
437 421
                     self::$supergroup = (object) self::$supergroup_default_data;
438 422
                     self::$group_ids = [];
439 423
                 }
440
-            }
441
-            elseif ($type === chatType::GROUP) {
424
+            } elseif ($type === chatType::GROUP) {
442 425
                 self::$group_id = $chat_id;
443 426
                 if (in_array($chat_id,self::$ids[$category])) {
444 427
                     self::$group = self::read($category . '/' . $chat_id);
445 428
                     self::$old_group = clone self::$group;
446 429
                     self::$group_ids = self::read($category . '/' . $chat_id . '/users');
447 430
                     self::$old_group_ids = clone self::$group_ids;
448
-                }
449
-                else {
431
+                } else {
450 432
                     self::$ids[$category][] = $chat_id;
451 433
                     self::$group = (object) self::$group_default_data;
452 434
                     self::$group_ids = [];
@@ -456,8 +438,7 @@  discard block
 block discarded – undo
456 438
             if (!in_array($user_id,self::$group_ids)) {
457 439
                 self::$group_ids[] = $user_id;
458 440
                 self::$group_user = (object) self::$group_user_default_data;
459
-            }
460
-            else {
441
+            } else {
461 442
                 self::$group_user_id = $by_id == $user_id ? $user_id : $by_id;
462 443
                 self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$group_user_id);
463 444
             }
@@ -470,8 +451,7 @@  discard block
 block discarded – undo
470 451
                         self::$group_user->removed_by = $by_id;
471 452
                     }
472 453
                 }
473
-            }
474
-            elseif ($old_user->status === chatMemberStatus::LEFT || $old_user->status === chatMemberStatus::KICKED) {
454
+            } elseif ($old_user->status === chatMemberStatus::LEFT || $old_user->status === chatMemberStatus::KICKED) {
475 455
                 self::$group_user->presence = true;
476 456
                 self::$group_user->removed = false;
477 457
                 self::$group_user->removed_by = null;
@@ -480,8 +460,7 @@  discard block
 block discarded – undo
480 460
                     if (!empty($invite_link)) {
481 461
                         self::$group_user->accepted_by = $by_id;
482 462
                         self::$group_user->invited_by = null;
483
-                    }
484
-                    else {
463
+                    } else {
485 464
                         self::$group_user->invited_by = $by_id;
486 465
                         self::$group_user->accepted_by = null;
487 466
                     }
@@ -499,7 +478,9 @@  discard block
 block discarded – undo
499 478
      * @throws bptException
500 479
      */
501 480
     public static function deleteUser (int $user_id = null): bool {
502
-        if (empty($user_id)) $user_id = telegram::catchFields(fields::USER_ID);
481
+        if (empty($user_id)) {
482
+            $user_id = telegram::catchFields(fields::USER_ID);
483
+        }
503 484
         if (!file_exists(realpath(self::$folder . '/privates/' . $user_id . '.json'))) {
504 485
             return false;
505 486
         }
@@ -520,7 +501,9 @@  discard block
 block discarded – undo
520 501
      * @throws bptException
521 502
      */
522 503
     public static function deleteGroup (int $group_id = null): bool {
523
-        if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID);
504
+        if (empty($group_id)) {
505
+            $group_id = telegram::catchFields(fields::CHAT_ID);
506
+        }
524 507
         if (!file_exists(realpath(self::$folder . '/groups/' . $group_id . '.json'))) {
525 508
             return false;
526 509
         }
@@ -542,7 +525,9 @@  discard block
 block discarded – undo
542 525
      * @throws bptException
543 526
      */
544 527
     public static function deleteSuperGroup (int $group_id = null): bool {
545
-        if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID);
528
+        if (empty($group_id)) {
529
+            $group_id = telegram::catchFields(fields::CHAT_ID);
530
+        }
546 531
         if (!file_exists(realpath(self::$folder . '/supergroups/' . $group_id . '.json'))) {
547 532
             return false;
548 533
         }
@@ -564,7 +549,9 @@  discard block
 block discarded – undo
564 549
      * @throws bptException
565 550
      */
566 551
     public static function deleteChannel (int $channel_id = null): bool {
567
-        if (empty($channel_id)) $channel_id = telegram::catchFields(fields::CHAT_ID);
552
+        if (empty($channel_id)) {
553
+            $channel_id = telegram::catchFields(fields::CHAT_ID);
554
+        }
568 555
         if (!file_exists(realpath(self::$folder . '/channels/' . $channel_id . '.json'))) {
569 556
             return false;
570 557
         }
Please login to merge, or discard this patch.
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
     /**
103 103
      * @internal Only for BPT self usage , Don't use it in your source!
104 104
      */
105
-    public static function init (string $bot_name, array $global = [], array $user = [], array $group_user = [], array $group = [], array $supergroup = [], array $channel = []): void {
106
-        self::$folder = $bot_name . 'database';
105
+    public static function init(string $bot_name, array $global = [], array $user = [], array $group_user = [], array $group = [], array $supergroup = [], array $channel = []): void {
106
+        self::$folder = $bot_name.'database';
107 107
         self::$global_default_data = $global ?? self::$global_default_data;
108 108
         self::setUserDefaultData($user);
109 109
         self::setGroupUserDefaultData($group_user);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         self::load();
115 115
     }
116 116
 
117
-    private static function setUserDefaultData (array $user = []): void {
117
+    private static function setUserDefaultData(array $user = []): void {
118 118
         self::$user_default_data = $user ?? self::$user_default_data;
119 119
         if (!isset(self::$user_default_data['step'])) {
120 120
             self::$user_default_data['step'] = 'none';
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         }
134 134
     }
135 135
 
136
-    private static function setGroupUserDefaultData (array $group_user = []): void {
136
+    private static function setGroupUserDefaultData(array $group_user = []): void {
137 137
         self::$group_user_default_data = $group_user ?? self::$group_user_default_data;
138 138
         if (!isset(self::$group_user_default_data['step'])) {
139 139
             self::$group_user_default_data['step'] = 'none';
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
         }
162 162
 
163 163
         if (!file_exists(realpath(self::$folder.'/global.json'))) {
164
-            file_put_contents(self::$folder.'/global.json',self::$global_default_data);
164
+            file_put_contents(self::$folder.'/global.json', self::$global_default_data);
165 165
         }
166 166
         if (!file_exists(realpath(self::$folder.'/ids.json'))) {
167
-            file_put_contents(self::$folder.'/ids.json',json_encode([
167
+            file_put_contents(self::$folder.'/ids.json', json_encode([
168 168
                 'privates' => [],
169 169
                 'groups' => [],
170 170
                 'supergroups' => [],
@@ -173,25 +173,25 @@  discard block
 block discarded – undo
173 173
         }
174 174
     }
175 175
 
176
-    private static function load (): void {
176
+    private static function load(): void {
177 177
         self::$global = json_decode(file_get_contents(self::$folder.'/global.json'));
178 178
         self::$old_global = clone self::$global;
179
-        self::$ids = json_decode(file_get_contents(self::$folder.'/ids.json'),true);
179
+        self::$ids = json_decode(file_get_contents(self::$folder.'/ids.json'), true);
180 180
         self::$old_ids = clone self::$ids;
181 181
     }
182 182
 
183
-    private static function read (string $address) {
183
+    private static function read(string $address) {
184 184
         return file_exists(realpath(self::$folder.'/'.$address.'.json')) ? json_decode(file_get_contents(self::$folder.'/'.$address.'.json'), false) : null;
185 185
     }
186 186
 
187
-    private static function write (string $address,string $data): void {
188
-        file_put_contents(self::$folder.'/'.$address.'.json',$data);
187
+    private static function write(string $address, string $data): void {
188
+        file_put_contents(self::$folder.'/'.$address.'.json', $data);
189 189
     }
190 190
 
191 191
     /**
192 192
      * @internal Only for BPT self usage , Don't use it in your source!
193 193
      */
194
-    public static function process (): void {
194
+    public static function process(): void {
195 195
         if (isset(BPT::$update->message)) {
196 196
             self::processMessage(BPT::$update->message);
197 197
         }
@@ -214,16 +214,16 @@  discard block
 block discarded – undo
214 214
      */
215 215
     public static function save(): void {
216 216
         if (self::$user !== self::$old_user && !empty(self::$user_id)) {
217
-            self::write('privates/' . self::$user_id,json_encode(self::$user));
217
+            self::write('privates/'.self::$user_id, json_encode(self::$user));
218 218
         }
219 219
         if (self::$group !== self::$old_group && !empty(self::$group_id)) {
220
-            self::write('groups/' . self::$group_id,json_encode(self::$group));
220
+            self::write('groups/'.self::$group_id, json_encode(self::$group));
221 221
         }
222 222
         if (self::$supergroup !== self::$old_supergroup && !empty(self::$supergroup_id)) {
223
-            self::write('supergroups/' . self::$supergroup_id,json_encode(self::$supergroup));
223
+            self::write('supergroups/'.self::$supergroup_id, json_encode(self::$supergroup));
224 224
         }
225 225
         if (self::$channel !== self::$old_channel && !empty(self::$channel_id)) {
226
-            self::write('channels/' . self::$channel_id,json_encode(self::$channel));
226
+            self::write('channels/'.self::$channel_id, json_encode(self::$channel));
227 227
         }
228 228
         if (self::$group_user !== self::$old_group_user && !empty(self::$group_user_id)) {
229 229
             if (empty(self::$group)) {
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
                 $category = 'groups';
235 235
                 $group_id = self::$group_id;
236 236
             }
237
-            self::write($category . '/' . $group_id . '/' . self::$group_user_id,json_encode(self::$group_user));
237
+            self::write($category.'/'.$group_id.'/'.self::$group_user_id, json_encode(self::$group_user));
238 238
         }
239 239
         if (self::$ids !== self::$old_ids) {
240
-            self::write('ids',json_encode(self::$ids));
240
+            self::write('ids', json_encode(self::$ids));
241 241
         }
242 242
         if (self::$global !== self::$old_global) {
243
-            self::write('global',json_encode(self::$global));
243
+            self::write('global', json_encode(self::$global));
244 244
         }
245 245
         if (self::$group_ids !== self::$old_group_ids) {
246 246
             if (empty(self::$group)) {
@@ -251,17 +251,17 @@  discard block
 block discarded – undo
251 251
                 $category = 'groups';
252 252
                 $group_id = self::$group_id;
253 253
             }
254
-            self::write($category . '/' . $group_id . '/users',json_encode(self::$group_user));
254
+            self::write($category.'/'.$group_id.'/users', json_encode(self::$group_user));
255 255
         }
256 256
     }
257 257
 
258 258
     private static function processMessage(message $update): void {
259 259
         $type = $update->chat->type;
260
-        $category = $type . 's';
260
+        $category = $type.'s';
261 261
         if ($type === chatType::PRIVATE) {
262 262
             self::$user_id = $update->from->id;
263
-            if (in_array(self::$user_id,self::$ids[$category])) {
264
-                self::$user = self::read($category . '/' . self::$user_id);
263
+            if (in_array(self::$user_id, self::$ids[$category])) {
264
+                self::$user = self::read($category.'/'.self::$user_id);
265 265
                 self::$old_user = clone self::$user;
266 266
                 self::$user->last_active = time();
267 267
             }
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
                 self::$ids[$category][] = self::$user_id;
270 270
                 self::$user = (object) self::$user_default_data;
271 271
                 self::$user->first_active = self::$user->last_active = time();
272
-                if (isset($update->command) && isset($update->command_payload) && $update->command === 'start' && str_starts_with($update->command_payload,'ref_')) {
273
-                    if (tools::isShorted(substr($update->command_payload,4))) {
274
-                        $referral = tools::shortDecode(substr($update->command_payload,4));
275
-                        if (in_array($referral,self::$ids[$category])) {
272
+                if (isset($update->command) && isset($update->command_payload) && $update->command === 'start' && str_starts_with($update->command_payload, 'ref_')) {
273
+                    if (tools::isShorted(substr($update->command_payload, 4))) {
274
+                        $referral = tools::shortDecode(substr($update->command_payload, 4));
275
+                        if (in_array($referral, self::$ids[$category])) {
276 276
                             self::$user->referral = $referral;
277 277
                         }
278 278
                     }
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
         }
282 282
         elseif ($type === chatType::CHANNEL) {
283 283
             self::$channel_id = $update->chat->id;
284
-            if (in_array(self::$channel_id,self::$ids[$category])) {
285
-                self::$channel = self::read($category . '/' . self::$channel_id);
284
+            if (in_array(self::$channel_id, self::$ids[$category])) {
285
+                self::$channel = self::read($category.'/'.self::$channel_id);
286 286
                 self::$old_channel = clone self::$channel;
287 287
             }
288 288
             else {
@@ -296,10 +296,10 @@  discard block
 block discarded – undo
296 296
             $chat_id = $update->chat->id;
297 297
             if ($type === chatType::SUPERGROUP) {
298 298
                 self::$supergroup_id = $update->chat->id;
299
-                if (in_array($chat_id,self::$ids[$category])) {
300
-                    self::$supergroup = self::read($category . '/' . $chat_id);
299
+                if (in_array($chat_id, self::$ids[$category])) {
300
+                    self::$supergroup = self::read($category.'/'.$chat_id);
301 301
                     self::$old_supergroup = clone self::$supergroup;
302
-                    self::$group_ids = self::read($category . '/' . $chat_id . '/users');
302
+                    self::$group_ids = self::read($category.'/'.$chat_id.'/users');
303 303
                     self::$old_group_ids = clone self::$group_ids;
304 304
                 }
305 305
                 else {
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
             }
311 311
             else {
312 312
                 self::$group_id = $update->chat->id;
313
-                if (in_array($chat_id,self::$ids[$category])) {
314
-                    self::$group = self::read($category . '/' . $chat_id);
313
+                if (in_array($chat_id, self::$ids[$category])) {
314
+                    self::$group = self::read($category.'/'.$chat_id);
315 315
                     self::$old_group = clone self::$group;
316
-                    self::$group_ids = self::read($category . '/' . $chat_id . '/users');
316
+                    self::$group_ids = self::read($category.'/'.$chat_id.'/users');
317 317
                     self::$old_group_ids = clone self::$group_ids;
318 318
                 }
319 319
                 else {
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
                 }
324 324
             }
325 325
 
326
-            if (in_array(self::$user_id,self::$group_ids)) {
327
-                self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$user_id);
326
+            if (in_array(self::$user_id, self::$group_ids)) {
327
+                self::$group_user = self::read($category.'/'.$chat_id.'/'.self::$user_id);
328 328
                 self::$old_group_user = clone self::$group_user;
329 329
             }
330 330
             else {
@@ -340,42 +340,42 @@  discard block
 block discarded – undo
340 340
 
341 341
     private static function processCallbackQuery(callbackQuery $update): void {
342 342
         $type = $update->message->chat->type;
343
-        $category = $type . 's';
343
+        $category = $type.'s';
344 344
         if ($type === chatType::PRIVATE) {
345 345
             self::$user_id = $update->from->id;
346
-            if (in_array(self::$user_id,self::$ids[$category])) {
347
-                self::$user = self::read($category . '/' . self::$user_id);
346
+            if (in_array(self::$user_id, self::$ids[$category])) {
347
+                self::$user = self::read($category.'/'.self::$user_id);
348 348
                 self::$old_user = clone self::$user;
349 349
                 self::$user->last_active = time();
350 350
             }
351 351
         }
352 352
         elseif ($type === chatType::CHANNEL) {
353 353
             self::$channel_id = $update->message->chat->id;
354
-            if (in_array(self::$channel_id,self::$ids[$category])) {
355
-                self::$channel = self::read($category . '/' . self::$channel_id);
354
+            if (in_array(self::$channel_id, self::$ids[$category])) {
355
+                self::$channel = self::read($category.'/'.self::$channel_id);
356 356
                 self::$old_channel = clone self::$channel;
357 357
             }
358 358
         }
359 359
         else {
360 360
             self::$user_id = $update->from->id;
361 361
             $chat_id = $update->message->chat->id;
362
-            if (in_array($chat_id,self::$ids[$category])) {
362
+            if (in_array($chat_id, self::$ids[$category])) {
363 363
                 if ($type === chatType::SUPERGROUP) {
364 364
                     self::$supergroup_id = $update->message->chat->id;
365
-                    self::$supergroup = self::read($category . '/' . $chat_id);
365
+                    self::$supergroup = self::read($category.'/'.$chat_id);
366 366
                     self::$old_supergroup = clone self::$supergroup;
367 367
                 }
368 368
                 else {
369 369
                     self::$group_id = $update->message->chat->id;
370
-                    self::$group = self::read($category . '/' . $chat_id);
370
+                    self::$group = self::read($category.'/'.$chat_id);
371 371
                     self::$old_group = clone self::$group;
372 372
                 }
373
-                self::$group_ids = self::read($category . '/' . $chat_id . '/users');
373
+                self::$group_ids = self::read($category.'/'.$chat_id.'/users');
374 374
                 self::$old_group_ids = clone self::$group_ids;
375 375
             }
376 376
 
377
-            if (in_array(self::$user_id,self::$group_ids)) {
378
-                self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$user_id);
377
+            if (in_array(self::$user_id, self::$group_ids)) {
378
+                self::$group_user = self::read($category.'/'.$chat_id.'/'.self::$user_id);
379 379
                 self::$group_user_id = self::$user_id;
380 380
                 self::$old_group_user = clone self::$group_user;
381 381
             }
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
     private static function processInlineQuery(inlineQuery $update): void {
390 390
         $type = $update->chat_type;
391 391
         if ($type === chatType::PRIVATE || $type === chatType::SENDER) {
392
-            $category = chatType::PRIVATE . 's';
392
+            $category = chatType::PRIVATE.'s';
393 393
             self::$user_id = $update->from->id;
394
-            if (in_array(self::$user_id,self::$ids[$category])) {
395
-                self::$user = self::read($category . '/' . self::$user_id);
394
+            if (in_array(self::$user_id, self::$ids[$category])) {
395
+                self::$user = self::read($category.'/'.self::$user_id);
396 396
                 self::$old_user = clone self::$user;
397 397
                 self::$user->last_active = time();
398 398
             }
@@ -402,11 +402,11 @@  discard block
 block discarded – undo
402 402
     private static function processChatMember(chatMemberUpdated $update): void {
403 403
         $type = $update->chat->type;
404 404
 
405
-        $category = $type . 's';
405
+        $category = $type.'s';
406 406
         if ($type === chatType::CHANNEL) {
407 407
             self::$channel_id = $update->chat->id;
408
-            if (in_array(self::$channel_id,self::$ids[$category])) {
409
-                self::$channel = self::read($category . '/' . self::$channel_id);
408
+            if (in_array(self::$channel_id, self::$ids[$category])) {
409
+                self::$channel = self::read($category.'/'.self::$channel_id);
410 410
                 self::$old_channel = clone self::$channel;
411 411
             }
412 412
             else {
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
 
426 426
             if ($type === chatType::SUPERGROUP) {
427 427
                 self::$supergroup_id = $chat_id;
428
-                if (in_array($chat_id,self::$ids[$category])) {
429
-                    self::$supergroup = self::read($category . '/' . $chat_id);
428
+                if (in_array($chat_id, self::$ids[$category])) {
429
+                    self::$supergroup = self::read($category.'/'.$chat_id);
430 430
                     self::$old_supergroup = clone self::$supergroup;
431
-                    self::$group_ids = self::read($category . '/' . $chat_id . '/users');
431
+                    self::$group_ids = self::read($category.'/'.$chat_id.'/users');
432 432
                     self::$old_group_ids = clone self::$group_ids;
433 433
                 }
434 434
                 else {
@@ -439,10 +439,10 @@  discard block
 block discarded – undo
439 439
             }
440 440
             elseif ($type === chatType::GROUP) {
441 441
                 self::$group_id = $chat_id;
442
-                if (in_array($chat_id,self::$ids[$category])) {
443
-                    self::$group = self::read($category . '/' . $chat_id);
442
+                if (in_array($chat_id, self::$ids[$category])) {
443
+                    self::$group = self::read($category.'/'.$chat_id);
444 444
                     self::$old_group = clone self::$group;
445
-                    self::$group_ids = self::read($category . '/' . $chat_id . '/users');
445
+                    self::$group_ids = self::read($category.'/'.$chat_id.'/users');
446 446
                     self::$old_group_ids = clone self::$group_ids;
447 447
                 }
448 448
                 else {
@@ -452,13 +452,13 @@  discard block
 block discarded – undo
452 452
                 }
453 453
             }
454 454
 
455
-            if (!in_array($user_id,self::$group_ids)) {
455
+            if (!in_array($user_id, self::$group_ids)) {
456 456
                 self::$group_ids[] = $user_id;
457 457
                 self::$group_user = (object) self::$group_user_default_data;
458 458
             }
459 459
             else {
460 460
                 self::$group_user_id = $by_id == $user_id ? $user_id : $by_id;
461
-                self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$group_user_id);
461
+                self::$group_user = self::read($category.'/'.$chat_id.'/'.self::$group_user_id);
462 462
             }
463 463
 
464 464
             if ($new_user->status === chatMemberStatus::LEFT || $new_user->status === chatMemberStatus::KICKED) {
@@ -497,9 +497,9 @@  discard block
 block discarded – undo
497 497
      * @return bool
498 498
      * @throws bptException
499 499
      */
500
-    public static function deleteUser (int $user_id = null): bool {
500
+    public static function deleteUser(int $user_id = null): bool {
501 501
         if (empty($user_id)) $user_id = telegram::catchFields(fields::USER_ID);
502
-        if (!file_exists(realpath(self::$folder . '/privates/' . $user_id . '.json'))) {
502
+        if (!file_exists(realpath(self::$folder.'/privates/'.$user_id.'.json'))) {
503 503
             return false;
504 504
         }
505 505
         unset(self::$ids['privates'][array_search($user_id, self::$ids['privates'])]);
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
         if ($user_id === self::$user_id) {
508 508
             self::$user = self::$old_user = null;
509 509
         }
510
-        return tools::delete(self::$folder . '/privates/' . $user_id . '.json');
510
+        return tools::delete(self::$folder.'/privates/'.$user_id.'.json');
511 511
     }
512 512
 
513 513
     /**
@@ -518,18 +518,18 @@  discard block
 block discarded – undo
518 518
      * @return bool
519 519
      * @throws bptException
520 520
      */
521
-    public static function deleteGroup (int $group_id = null): bool {
521
+    public static function deleteGroup(int $group_id = null): bool {
522 522
         if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID);
523
-        if (!file_exists(realpath(self::$folder . '/groups/' . $group_id . '.json'))) {
523
+        if (!file_exists(realpath(self::$folder.'/groups/'.$group_id.'.json'))) {
524 524
             return false;
525 525
         }
526 526
         unset(self::$ids['groups'][array_search($group_id, self::$ids['groups'])]);
527 527
         sort(self::$ids['groups']);
528
-        tools::delete(self::$folder . '/groups/' . $group_id);
528
+        tools::delete(self::$folder.'/groups/'.$group_id);
529 529
         if ($group_id === self::$group_id) {
530 530
             self::$group = self::$old_group = null;
531 531
         }
532
-        return tools::delete(self::$folder . '/groups/' . $group_id . '.json');
532
+        return tools::delete(self::$folder.'/groups/'.$group_id.'.json');
533 533
     }
534 534
 
535 535
     /**
@@ -540,18 +540,18 @@  discard block
 block discarded – undo
540 540
      * @return bool
541 541
      * @throws bptException
542 542
      */
543
-    public static function deleteSuperGroup (int $group_id = null): bool {
543
+    public static function deleteSuperGroup(int $group_id = null): bool {
544 544
         if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID);
545
-        if (!file_exists(realpath(self::$folder . '/supergroups/' . $group_id . '.json'))) {
545
+        if (!file_exists(realpath(self::$folder.'/supergroups/'.$group_id.'.json'))) {
546 546
             return false;
547 547
         }
548 548
         unset(self::$ids['supergroups'][array_search($group_id, self::$ids['supergroups'])]);
549 549
         sort(self::$ids['supergroups']);
550
-        tools::delete(self::$folder . '/supergroups/' . $group_id);
550
+        tools::delete(self::$folder.'/supergroups/'.$group_id);
551 551
         if ($group_id === self::$supergroup_id) {
552 552
             self::$supergroup = self::$old_supergroup = null;
553 553
         }
554
-        return tools::delete(self::$folder . '/supergroups/' . $group_id . '.json');
554
+        return tools::delete(self::$folder.'/supergroups/'.$group_id.'.json');
555 555
     }
556 556
 
557 557
     /**
@@ -562,9 +562,9 @@  discard block
 block discarded – undo
562 562
      * @return bool
563 563
      * @throws bptException
564 564
      */
565
-    public static function deleteChannel (int $channel_id = null): bool {
565
+    public static function deleteChannel(int $channel_id = null): bool {
566 566
         if (empty($channel_id)) $channel_id = telegram::catchFields(fields::CHAT_ID);
567
-        if (!file_exists(realpath(self::$folder . '/channels/' . $channel_id . '.json'))) {
567
+        if (!file_exists(realpath(self::$folder.'/channels/'.$channel_id.'.json'))) {
568 568
             return false;
569 569
         }
570 570
         unset(self::$ids['channels'][array_search($channel_id, self::$ids['channels'])]);
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
         if ($channel_id === self::$channel_id) {
573 573
             self::$channel = self::$old_channel = null;
574 574
         }
575
-        return tools::delete(self::$folder . '/channels/' . $channel_id . '.json');
575
+        return tools::delete(self::$folder.'/channels/'.$channel_id.'.json');
576 576
     }
577 577
 
578 578
     /**
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
      *
581 581
      * @return int[]
582 582
      */
583
-    public static function getUsers (): array {
583
+    public static function getUsers(): array {
584 584
         return self::$ids['privates'] ?? [];
585 585
     }
586 586
 
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
      *
590 590
      * @return int[]
591 591
      */
592
-    public static function getGroups (): array {
592
+    public static function getGroups(): array {
593 593
         return self::$ids['groups'] ?? [];
594 594
     }
595 595
 
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
      *
599 599
      * @return int[]
600 600
      */
601
-    public static function getSuperGroups (): array {
601
+    public static function getSuperGroups(): array {
602 602
         return self::$ids['supergroups'] ?? [];
603 603
     }
604 604
 
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
      *
608 608
      * @return int[]
609 609
      */
610
-    public static function getChannels (): array {
610
+    public static function getChannels(): array {
611 611
         return self::$ids['channels'] ?? [];
612 612
     }
613 613
 }
Please login to merge, or discard this patch.
src/types/chatJoinRequest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
     public int $date;
36 36
 
37 37
     /** Optional. Bio of the user. */
38
-    public null|string $bio = null;
38
+    public null | string $bio = null;
39 39
 
40 40
     /** Optional. Chat invite link that was used by the user to send the join request */
41
-    public null|chatInviteLink $invite_link = null;
41
+    public null | chatInviteLink $invite_link = null;
42 42
 
43 43
 
44
-    public function __construct(stdClass|null $object = null) {
44
+    public function __construct(stdClass | null $object = null) {
45 45
         if ($object != null) {
46 46
             parent::__construct($object, self::subs);
47 47
         }
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @return responseError|bool
56 56
      */
57
-    public function accept(bool $answer = null): responseError|bool {
58
-        return telegram::approveChatJoinRequest($this->chat->id,$this->from->id, answer: $answer);
57
+    public function accept(bool $answer = null): responseError | bool {
58
+        return telegram::approveChatJoinRequest($this->chat->id, $this->from->id, answer: $answer);
59 59
     }
60 60
 
61 61
     /**
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
      *
66 66
      * @return responseError|bool
67 67
      */
68
-    public function deny(bool $answer = null): responseError|bool {
69
-        return telegram::declineChatJoinRequest($this->chat->id,$this->from->id, answer: $answer);
68
+    public function deny(bool $answer = null): responseError | bool {
69
+        return telegram::declineChatJoinRequest($this->chat->id, $this->from->id, answer: $answer);
70 70
     }
71 71
 
72 72
     /**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      *
77 77
      * @return responseError|bool
78 78
      */
79
-    public function revokeLink(bool $answer = null): responseError|bool {
79
+    public function revokeLink(bool $answer = null): responseError | bool {
80 80
         return telegram::revokeChatInviteLink($this->invite_link->invite_link, $this->chat->id, answer: $answer);
81 81
     }
82 82
 }
Please login to merge, or discard this patch.
src/types/shippingQuery.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     public shippingAddress $shipping_address;
26 26
 
27 27
 
28
-    public function __construct(stdClass|null $object = null) {
28
+    public function __construct(stdClass | null $object = null) {
29 29
         if ($object != null) {
30 30
             parent::__construct($object, self::subs);
31 31
         }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @return responseError|bool
45 45
      */
46
-    public function answer (bool $ok, null|array $shipping_options = null, string|null $error_message = null, bool $answer = null): responseError|bool {
46
+    public function answer(bool $ok, null | array $shipping_options = null, string | null $error_message = null, bool $answer = null): responseError | bool {
47 47
         return telegram::answerShippingQuery($ok, $this->id, $shipping_options, $error_message, answer: $answer);
48 48
     }
49 49
 }
Please login to merge, or discard this patch.
src/types/preCheckoutQuery.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
     public string $invoice_payload;
33 33
 
34 34
     /** Optional. Identifier of the shipping option chosen by the user */
35
-    public null|string $shipping_option_id = null;
35
+    public null | string $shipping_option_id = null;
36 36
 
37 37
     /** Optional. Order information provided by the user */
38
-    public null|orderInfo $order_info = null;
38
+    public null | orderInfo $order_info = null;
39 39
 
40 40
 
41
-    public function __construct(stdClass|null $object = null) {
41
+    public function __construct(stdClass | null $object = null) {
42 42
         if ($object != null) {
43 43
             parent::__construct($object, self::subs);
44 44
         }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      *
57 57
      * @return responseError|bool
58 58
      */
59
-    public function answer (bool $ok, string|null $error_message = null, bool $answer = null): responseError|bool {
59
+    public function answer(bool $ok, string | null $error_message = null, bool $answer = null): responseError | bool {
60 60
         return telegram::answerPreCheckoutQuery($ok, $this->id, $error_message, answer: $answer);
61 61
     }
62 62
 }
Please login to merge, or discard this patch.
src/types/sticker.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -38,25 +38,25 @@  discard block
 block discarded – undo
38 38
     public int $height;
39 39
 
40 40
     /** True, if the sticker is animated */
41
-    public null|bool $is_animated = null;
41
+    public null | bool $is_animated = null;
42 42
 
43 43
     /** True, if the sticker is a video sticker */
44
-    public null|bool $is_video = null;
44
+    public null | bool $is_video = null;
45 45
 
46 46
     /** Optional. Sticker thumbnail in the .WEBP or .JPG format */
47
-    public null|photoSize $thumbnail = null;
47
+    public null | photoSize $thumbnail = null;
48 48
 
49 49
     /** Optional. Emoji associated with the sticker */
50
-    public null|string $emoji = null;
50
+    public null | string $emoji = null;
51 51
 
52 52
     /** Optional. Name of the sticker set to which the sticker belongs */
53
-    public null|string $set_name = null;
53
+    public null | string $set_name = null;
54 54
 
55 55
     /** Optional. Premium animation for the sticker, if the sticker is premium */
56
-    public null|file $premium_animation = null;
56
+    public null | file $premium_animation = null;
57 57
 
58 58
     /** Optional. For mask stickers, the position where the mask should be placed */
59
-    public null|maskPosition $mask_position = null;
59
+    public null | maskPosition $mask_position = null;
60 60
 
61 61
     /** Optional. For custom emoji stickers, unique identifier of the custom emoji */
62 62
     public string $custom_emoji_id;
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
     public bool $needs_repainting;
69 69
 
70 70
     /** Optional. File size in bytes */
71
-    public null|int $file_size = null;
71
+    public null | int $file_size = null;
72 72
 
73 73
 
74
-    public function __construct(stdClass|null $object = null) {
74
+    public function __construct(stdClass | null $object = null) {
75 75
         if ($object != null) {
76 76
             parent::__construct($object, self::subs);
77 77
         }
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
      *
93 93
      * @return bool|string string will be returned when destination doesn't set
94 94
      */
95
-    public function download(string|null $destination = null): bool|string {
96
-        return telegram::downloadFile($destination ?? 'unknown.png',$this->file_id);
95
+    public function download(string | null $destination = null): bool | string {
96
+        return telegram::downloadFile($destination ?? 'unknown.png', $this->file_id);
97 97
     }
98 98
 
99 99
     /**
Please login to merge, or discard this patch.
src/types/photoSize.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
     public int $height;
29 29
 
30 30
     /** Optional. File size in bytes */
31
-    public null|int $file_size = null;
31
+    public null | int $file_size = null;
32 32
 
33 33
 
34
-    public function __construct(stdClass|null $object = null) {
34
+    public function __construct(stdClass | null $object = null) {
35 35
         if ($object != null) {
36 36
             parent::__construct($object, self::subs);
37 37
         }
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
      *
53 53
      * @return bool|string string will be returned when destination doesn't set
54 54
      */
55
-    public function download(string|null $destination = null): bool|string {
56
-        return telegram::downloadFile($destination ?? 'unknown.jpg',$this->file_id);
55
+    public function download(string | null $destination = null): bool | string {
56
+        return telegram::downloadFile($destination ?? 'unknown.jpg', $this->file_id);
57 57
     }
58 58
 
59 59
     /**
Please login to merge, or discard this patch.
src/types/chatPhoto.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public string $big_file_unique_id;
38 38
 
39 39
 
40
-    public function __construct(stdClass|null $object = null) {
40
+    public function __construct(stdClass | null $object = null) {
41 41
         if ($object != null) {
42 42
             parent::__construct($object, self::subs);
43 43
         }
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
      *
60 60
      * @return bool|string string will be returned when destination doesn't set
61 61
      */
62
-    public function download(string|null $destination = null,bool $big = true): bool|string {
63
-        return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4',$big ? $this->big_file_id : $this->small_file_id);
62
+    public function download(string | null $destination = null, bool $big = true): bool | string {
63
+        return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4', $big ? $this->big_file_id : $this->small_file_id);
64 64
     }
65 65
 
66 66
     /**
Please login to merge, or discard this patch.
src/types/chatInviteLink.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,22 +31,22 @@  discard block
 block discarded – undo
31 31
     public bool $is_revoked;
32 32
 
33 33
     /** Optional. Invite link name */
34
-    public null|string $name = null;
34
+    public null | string $name = null;
35 35
 
36 36
     /** Optional. Point in time (Unix timestamp) when the link will expire or has been expired */
37
-    public null|int $expire_date = null;
37
+    public null | int $expire_date = null;
38 38
 
39 39
     /**
40 40
      * Optional. The maximum number of users that can be members of the chat simultaneously after joining the chat
41 41
      * via this invite link; 1-99999
42 42
      */
43
-    public null|int $member_limit = null;
43
+    public null | int $member_limit = null;
44 44
 
45 45
     /** Optional. Number of pending join requests created using this link */
46
-    public null|int $pending_join_request_count = null;
46
+    public null | int $pending_join_request_count = null;
47 47
 
48 48
 
49
-    public function __construct(stdClass|null $object = null) {
49
+    public function __construct(stdClass | null $object = null) {
50 50
         if ($object != null) {
51 51
             parent::__construct($object, self::subs);
52 52
         }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return responseError|bool|self
59 59
      */
60
-    public function revoke(): self|responseError|bool {
60
+    public function revoke(): self | responseError | bool {
61 61
         return $this->is_revoked ?? telegram::revokeChatInviteLink($this->invite_link);
62 62
     }
63 63
 }
Please login to merge, or discard this patch.