Passed
Push — main ( 49f27d...1e0eff )
by Miaad
01:40
created
src/database/json.php 2 patches
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     /**
104 104
      * @internal Only for BPT self usage , Don't use it in your source!
105 105
      */
106
-    public static function init (): void {
106
+    public static function init(): void {
107 107
         self::$folder = settings::$name.'database';
108 108
         self::$global_default_data = settings::$db['global'] ?? self::$global_default_data;
109 109
         self::setUserDefaultData();
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         self::load();
116 116
     }
117 117
 
118
-    private static function setUserDefaultData (): void {
118
+    private static function setUserDefaultData(): void {
119 119
         self::$user_default_data = settings::$db['user'] ?? self::$user_default_data;
120 120
         if (!isset(self::$user_default_data['step'])) {
121 121
             self::$user_default_data['step'] = 'none';
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         }
135 135
     }
136 136
 
137
-    private static function setGroupUserDefaultData (): void {
137
+    private static function setGroupUserDefaultData(): void {
138 138
         self::$group_user_default_data = settings::$db['group_user'] ?? self::$group_user_default_data;
139 139
         if (!isset(self::$group_user_default_data['step'])) {
140 140
             self::$group_user_default_data['step'] = 'none';
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
         }
163 163
 
164 164
         if (!file_exists(self::$folder.'/global.json')) {
165
-            file_put_contents(self::$folder.'/global.json',self::$global_default_data);
165
+            file_put_contents(self::$folder.'/global.json', self::$global_default_data);
166 166
         }
167 167
         if (!file_exists(self::$folder.'/ids.json')) {
168
-            file_put_contents(self::$folder.'/ids.json',json_encode([
168
+            file_put_contents(self::$folder.'/ids.json', json_encode([
169 169
                 'privates' => [],
170 170
                 'groups' => [],
171 171
                 'supergroups' => [],
@@ -174,25 +174,25 @@  discard block
 block discarded – undo
174 174
         }
175 175
     }
176 176
 
177
-    private static function load (): void {
177
+    private static function load(): void {
178 178
         self::$global = json_decode(file_get_contents(self::$folder.'/global.json'));
179 179
         self::$old_global = clone self::$global;
180
-        self::$ids = json_decode(file_get_contents(self::$folder.'/ids.json'),true);
180
+        self::$ids = json_decode(file_get_contents(self::$folder.'/ids.json'), true);
181 181
         self::$old_ids = clone self::$ids;
182 182
     }
183 183
 
184
-    private static function read (string $address) {
184
+    private static function read(string $address) {
185 185
         return file_exists(self::$folder.'/'.$address.'.json') ? json_decode(file_get_contents(self::$folder.'/'.$address.'.json'), false) : null;
186 186
     }
187 187
 
188
-    private static function write (string $address,string $data): void {
189
-        file_put_contents(self::$folder.'/'.$address.'.json',$data);
188
+    private static function write(string $address, string $data): void {
189
+        file_put_contents(self::$folder.'/'.$address.'.json', $data);
190 190
     }
191 191
 
192 192
     /**
193 193
      * @internal Only for BPT self usage , Don't use it in your source!
194 194
      */
195
-    public static function process (): void {
195
+    public static function process(): void {
196 196
         if (isset(BPT::$update->message)) {
197 197
             self::processMessage(BPT::$update->message);
198 198
         }
@@ -215,16 +215,16 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public static function save(): void {
217 217
         if (self::$user !== self::$old_user && !empty(self::$user_id)) {
218
-            self::write('privates/' . self::$user_id,json_encode(self::$user));
218
+            self::write('privates/'.self::$user_id, json_encode(self::$user));
219 219
         }
220 220
         if (self::$group !== self::$old_group && !empty(self::$group_id)) {
221
-            self::write('groups/' . self::$group_id,json_encode(self::$group));
221
+            self::write('groups/'.self::$group_id, json_encode(self::$group));
222 222
         }
223 223
         if (self::$supergroup !== self::$old_supergroup && !empty(self::$supergroup_id)) {
224
-            self::write('supergroups/' . self::$supergroup_id,json_encode(self::$supergroup));
224
+            self::write('supergroups/'.self::$supergroup_id, json_encode(self::$supergroup));
225 225
         }
226 226
         if (self::$channel !== self::$old_channel && !empty(self::$channel_id)) {
227
-            self::write('channels/' . self::$channel_id,json_encode(self::$channel));
227
+            self::write('channels/'.self::$channel_id, json_encode(self::$channel));
228 228
         }
229 229
         if (self::$group_user !== self::$old_group_user && !empty(self::$group_user_id)) {
230 230
             if (empty(self::$group)) {
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
                 $category = 'groups';
236 236
                 $group_id = self::$group_id;
237 237
             }
238
-            self::write($category . '/' . $group_id . '/' . self::$group_user_id,json_encode(self::$group_user));
238
+            self::write($category.'/'.$group_id.'/'.self::$group_user_id, json_encode(self::$group_user));
239 239
         }
240 240
         if (self::$ids !== self::$old_ids) {
241
-            self::write('ids',json_encode(self::$ids));
241
+            self::write('ids', json_encode(self::$ids));
242 242
         }
243 243
         if (self::$global !== self::$old_global) {
244
-            self::write('global',json_encode(self::$global));
244
+            self::write('global', json_encode(self::$global));
245 245
         }
246 246
         if (self::$group_ids !== self::$old_group_ids) {
247 247
             if (empty(self::$group)) {
@@ -252,17 +252,17 @@  discard block
 block discarded – undo
252 252
                 $category = 'groups';
253 253
                 $group_id = self::$group_id;
254 254
             }
255
-            self::write($category . '/' . $group_id . '/users',json_encode(self::$group_user));
255
+            self::write($category.'/'.$group_id.'/users', json_encode(self::$group_user));
256 256
         }
257 257
     }
258 258
 
259 259
     private static function processMessage(message $update): void {
260 260
         $type = $update->chat->type;
261
-        $category = $type . 's';
261
+        $category = $type.'s';
262 262
         if ($type === chatType::PRIVATE) {
263 263
             self::$user_id = $update->from->id;
264
-            if (in_array(self::$user_id,self::$ids[$category])) {
265
-                self::$user = self::read($category . '/' . self::$user_id);
264
+            if (in_array(self::$user_id, self::$ids[$category])) {
265
+                self::$user = self::read($category.'/'.self::$user_id);
266 266
                 self::$old_user = clone self::$user;
267 267
                 self::$user->last_active = time();
268 268
             }
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
                 self::$ids[$category][] = self::$user_id;
271 271
                 self::$user = (object) self::$user_default_data;
272 272
                 self::$user->first_active = self::$user->last_active = time();
273
-                if (isset($update->commend) && isset($update->commend_payload) && $update->commend === 'start' && str_starts_with($update->commend_payload,'ref_')) {
274
-                    if (tools::isShorted(substr($update->commend_payload,4))) {
275
-                        $referral = tools::shortDecode(substr($update->commend_payload,4));
276
-                        if (in_array($referral,self::$ids[$category])) {
273
+                if (isset($update->commend) && isset($update->commend_payload) && $update->commend === 'start' && str_starts_with($update->commend_payload, 'ref_')) {
274
+                    if (tools::isShorted(substr($update->commend_payload, 4))) {
275
+                        $referral = tools::shortDecode(substr($update->commend_payload, 4));
276
+                        if (in_array($referral, self::$ids[$category])) {
277 277
                             self::$user->referral = $referral;
278 278
                         }
279 279
                     }
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
         }
283 283
         elseif ($type === chatType::CHANNEL) {
284 284
             self::$channel_id = $update->chat->id;
285
-            if (in_array(self::$channel_id,self::$ids[$category])) {
286
-                self::$channel = self::read($category . '/' . self::$channel_id);
285
+            if (in_array(self::$channel_id, self::$ids[$category])) {
286
+                self::$channel = self::read($category.'/'.self::$channel_id);
287 287
                 self::$old_channel = clone self::$channel;
288 288
             }
289 289
             else {
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
             $chat_id = $update->chat->id;
298 298
             if ($type === chatType::SUPERGROUP) {
299 299
                 self::$supergroup_id = $update->chat->id;
300
-                if (in_array($chat_id,self::$ids[$category])) {
301
-                    self::$supergroup = self::read($category . '/' . $chat_id);
300
+                if (in_array($chat_id, self::$ids[$category])) {
301
+                    self::$supergroup = self::read($category.'/'.$chat_id);
302 302
                     self::$old_supergroup = clone self::$supergroup;
303
-                    self::$group_ids = self::read($category . '/' . $chat_id . '/users');
303
+                    self::$group_ids = self::read($category.'/'.$chat_id.'/users');
304 304
                     self::$old_group_ids = clone self::$group_ids;
305 305
                 }
306 306
                 else {
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
             }
312 312
             else {
313 313
                 self::$group_id = $update->chat->id;
314
-                if (in_array($chat_id,self::$ids[$category])) {
315
-                    self::$group = self::read($category . '/' . $chat_id);
314
+                if (in_array($chat_id, self::$ids[$category])) {
315
+                    self::$group = self::read($category.'/'.$chat_id);
316 316
                     self::$old_group = clone self::$group;
317
-                    self::$group_ids = self::read($category . '/' . $chat_id . '/users');
317
+                    self::$group_ids = self::read($category.'/'.$chat_id.'/users');
318 318
                     self::$old_group_ids = clone self::$group_ids;
319 319
                 }
320 320
                 else {
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
                 }
325 325
             }
326 326
 
327
-            if (in_array(self::$user_id,self::$group_ids)) {
328
-                self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$user_id);
327
+            if (in_array(self::$user_id, self::$group_ids)) {
328
+                self::$group_user = self::read($category.'/'.$chat_id.'/'.self::$user_id);
329 329
                 self::$old_group_user = clone self::$group_user;
330 330
             }
331 331
             else {
@@ -341,42 +341,42 @@  discard block
 block discarded – undo
341 341
 
342 342
     private static function processCallbackQuery(callbackQuery $update): void {
343 343
         $type = $update->message->chat->type;
344
-        $category = $type . 's';
344
+        $category = $type.'s';
345 345
         if ($type === chatType::PRIVATE) {
346 346
             self::$user_id = $update->from->id;
347
-            if (in_array(self::$user_id,self::$ids[$category])) {
348
-                self::$user = self::read($category . '/' . self::$user_id);
347
+            if (in_array(self::$user_id, self::$ids[$category])) {
348
+                self::$user = self::read($category.'/'.self::$user_id);
349 349
                 self::$old_user = clone self::$user;
350 350
                 self::$user->last_active = time();
351 351
             }
352 352
         }
353 353
         elseif ($type === chatType::CHANNEL) {
354 354
             self::$channel_id = $update->message->chat->id;
355
-            if (in_array(self::$channel_id,self::$ids[$category])) {
356
-                self::$channel = self::read($category . '/' . self::$channel_id);
355
+            if (in_array(self::$channel_id, self::$ids[$category])) {
356
+                self::$channel = self::read($category.'/'.self::$channel_id);
357 357
                 self::$old_channel = clone self::$channel;
358 358
             }
359 359
         }
360 360
         else {
361 361
             self::$user_id = $update->from->id;
362 362
             $chat_id = $update->message->chat->id;
363
-            if (in_array($chat_id,self::$ids[$category])) {
363
+            if (in_array($chat_id, self::$ids[$category])) {
364 364
                 if ($type === chatType::SUPERGROUP) {
365 365
                     self::$supergroup_id = $update->message->chat->id;
366
-                    self::$supergroup = self::read($category . '/' . $chat_id);
366
+                    self::$supergroup = self::read($category.'/'.$chat_id);
367 367
                     self::$old_supergroup = clone self::$supergroup;
368 368
                 }
369 369
                 else {
370 370
                     self::$group_id = $update->message->chat->id;
371
-                    self::$group = self::read($category . '/' . $chat_id);
371
+                    self::$group = self::read($category.'/'.$chat_id);
372 372
                     self::$old_group = clone self::$group;
373 373
                 }
374
-                self::$group_ids = self::read($category . '/' . $chat_id . '/users');
374
+                self::$group_ids = self::read($category.'/'.$chat_id.'/users');
375 375
                 self::$old_group_ids = clone self::$group_ids;
376 376
             }
377 377
 
378
-            if (in_array(self::$user_id,self::$group_ids)) {
379
-                self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$user_id);
378
+            if (in_array(self::$user_id, self::$group_ids)) {
379
+                self::$group_user = self::read($category.'/'.$chat_id.'/'.self::$user_id);
380 380
                 self::$group_user_id = self::$user_id;
381 381
                 self::$old_group_user = clone self::$group_user;
382 382
             }
@@ -390,10 +390,10 @@  discard block
 block discarded – undo
390 390
     private static function processInlineQuery(inlineQuery $update): void {
391 391
         $type = $update->chat_type;
392 392
         if ($type === chatType::PRIVATE || $type === chatType::SENDER) {
393
-            $category = chatType::PRIVATE . 's';
393
+            $category = chatType::PRIVATE.'s';
394 394
             self::$user_id = $update->from->id;
395
-            if (in_array(self::$user_id,self::$ids[$category])) {
396
-                self::$user = self::read($category . '/' . self::$user_id);
395
+            if (in_array(self::$user_id, self::$ids[$category])) {
396
+                self::$user = self::read($category.'/'.self::$user_id);
397 397
                 self::$old_user = clone self::$user;
398 398
                 self::$user->last_active = time();
399 399
             }
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
     private static function processChatMember(chatMemberUpdated $update): void {
404 404
         $type = $update->chat->type;
405 405
 
406
-        $category = $type . 's';
406
+        $category = $type.'s';
407 407
         if ($type === chatType::CHANNEL) {
408 408
             self::$channel_id = $update->chat->id;
409
-            if (in_array(self::$channel_id,self::$ids[$category])) {
410
-                self::$channel = self::read($category . '/' . self::$channel_id);
409
+            if (in_array(self::$channel_id, self::$ids[$category])) {
410
+                self::$channel = self::read($category.'/'.self::$channel_id);
411 411
                 self::$old_channel = clone self::$channel;
412 412
             }
413 413
             else {
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 
427 427
             if ($type === chatType::SUPERGROUP) {
428 428
                 self::$supergroup_id = $chat_id;
429
-                if (in_array($chat_id,self::$ids[$category])) {
430
-                    self::$supergroup = self::read($category . '/' . $chat_id);
429
+                if (in_array($chat_id, self::$ids[$category])) {
430
+                    self::$supergroup = self::read($category.'/'.$chat_id);
431 431
                     self::$old_supergroup = clone self::$supergroup;
432
-                    self::$group_ids = self::read($category . '/' . $chat_id . '/users');
432
+                    self::$group_ids = self::read($category.'/'.$chat_id.'/users');
433 433
                     self::$old_group_ids = clone self::$group_ids;
434 434
                 }
435 435
                 else {
@@ -440,10 +440,10 @@  discard block
 block discarded – undo
440 440
             }
441 441
             elseif ($type === chatType::GROUP) {
442 442
                 self::$group_id = $chat_id;
443
-                if (in_array($chat_id,self::$ids[$category])) {
444
-                    self::$group = self::read($category . '/' . $chat_id);
443
+                if (in_array($chat_id, self::$ids[$category])) {
444
+                    self::$group = self::read($category.'/'.$chat_id);
445 445
                     self::$old_group = clone self::$group;
446
-                    self::$group_ids = self::read($category . '/' . $chat_id . '/users');
446
+                    self::$group_ids = self::read($category.'/'.$chat_id.'/users');
447 447
                     self::$old_group_ids = clone self::$group_ids;
448 448
                 }
449 449
                 else {
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
                 }
454 454
             }
455 455
 
456
-            if (!in_array($user_id,self::$group_ids)) {
456
+            if (!in_array($user_id, self::$group_ids)) {
457 457
                 self::$group_ids[] = $user_id;
458 458
                 self::$group_user = (object) self::$group_user_default_data;
459 459
             }
460 460
             else {
461 461
                 self::$group_user_id = $by_id == $user_id ? $user_id : $by_id;
462
-                self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$group_user_id);
462
+                self::$group_user = self::read($category.'/'.$chat_id.'/'.self::$group_user_id);
463 463
             }
464 464
 
465 465
             if ($new_user->status === chatMemberStatus::LEFT || $new_user->status === chatMemberStatus::KICKED) {
@@ -500,15 +500,15 @@  discard block
 block discarded – undo
500 500
      * @return bool
501 501
      * @throws bptException
502 502
      */
503
-    public static function deleteUser (int $user_id = null): bool {
503
+    public static function deleteUser(int $user_id = null): bool {
504 504
         if (empty($user_id)) $user_id = telegram::catchFields(fields::USER_ID);
505
-        if (file_exists(self::$folder . '/privates/' . $user_id . '.json')) {
505
+        if (file_exists(self::$folder.'/privates/'.$user_id.'.json')) {
506 506
             unset(self::$ids['privates'][array_search($user_id, self::$ids['privates'])]);
507 507
             sort(self::$ids['privates']);
508 508
             if ($user_id === self::$user_id) {
509 509
                 self::$user = self::$old_user = null;
510 510
             }
511
-            return tools::delete(self::$folder . '/privates/' . $user_id . '.json');
511
+            return tools::delete(self::$folder.'/privates/'.$user_id.'.json');
512 512
         }
513 513
         return false;
514 514
     }
@@ -521,16 +521,16 @@  discard block
 block discarded – undo
521 521
      * @return bool
522 522
      * @throws bptException
523 523
      */
524
-    public static function deleteGroup (int $group_id = null): bool {
524
+    public static function deleteGroup(int $group_id = null): bool {
525 525
         if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID);
526
-        if (file_exists(self::$folder . '/groups/' . $group_id . '.json')) {
526
+        if (file_exists(self::$folder.'/groups/'.$group_id.'.json')) {
527 527
             unset(self::$ids['groups'][array_search($group_id, self::$ids['groups'])]);
528 528
             sort(self::$ids['groups']);
529
-            tools::delete(self::$folder . '/groups/' . $group_id);
529
+            tools::delete(self::$folder.'/groups/'.$group_id);
530 530
             if ($group_id === self::$group_id) {
531 531
                 self::$group = self::$old_group = null;
532 532
             }
533
-            return tools::delete(self::$folder . '/groups/' . $group_id . '.json');
533
+            return tools::delete(self::$folder.'/groups/'.$group_id.'.json');
534 534
         }
535 535
         return false;
536 536
     }
@@ -543,16 +543,16 @@  discard block
 block discarded – undo
543 543
      * @return bool
544 544
      * @throws bptException
545 545
      */
546
-    public static function deleteSuperGroup (int $group_id = null): bool {
546
+    public static function deleteSuperGroup(int $group_id = null): bool {
547 547
         if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID);
548
-        if (file_exists(self::$folder . '/supergroups/' . $group_id . '.json')) {
548
+        if (file_exists(self::$folder.'/supergroups/'.$group_id.'.json')) {
549 549
             unset(self::$ids['supergroups'][array_search($group_id, self::$ids['supergroups'])]);
550 550
             sort(self::$ids['supergroups']);
551
-            tools::delete(self::$folder . '/supergroups/' . $group_id);
551
+            tools::delete(self::$folder.'/supergroups/'.$group_id);
552 552
             if ($group_id === self::$supergroup_id) {
553 553
                 self::$supergroup = self::$old_supergroup = null;
554 554
             }
555
-            return tools::delete(self::$folder . '/supergroups/' . $group_id . '.json');
555
+            return tools::delete(self::$folder.'/supergroups/'.$group_id.'.json');
556 556
         }
557 557
         return false;
558 558
     }
@@ -565,15 +565,15 @@  discard block
 block discarded – undo
565 565
      * @return bool
566 566
      * @throws bptException
567 567
      */
568
-    public static function deleteChannel (int $channel_id = null): bool {
568
+    public static function deleteChannel(int $channel_id = null): bool {
569 569
         if (empty($channel_id)) $channel_id = telegram::catchFields(fields::CHAT_ID);
570
-        if (file_exists(self::$folder . '/channels/' . $channel_id . '.json')) {
570
+        if (file_exists(self::$folder.'/channels/'.$channel_id.'.json')) {
571 571
             unset(self::$ids['channels'][array_search($channel_id, self::$ids['channels'])]);
572 572
             sort(self::$ids['channels']);
573 573
             if ($channel_id === self::$channel_id) {
574 574
                 self::$channel = self::$old_channel = null;
575 575
             }
576
-            return tools::delete(self::$folder . '/channels/' . $channel_id . '.json');
576
+            return tools::delete(self::$folder.'/channels/'.$channel_id.'.json');
577 577
         }
578 578
         return false;
579 579
     }
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
      *
584 584
      * @return int[]
585 585
      */
586
-    public static function getUsers (): array {
586
+    public static function getUsers(): array {
587 587
         return self::$ids['privates'] ?? [];
588 588
     }
589 589
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
      *
593 593
      * @return int[]
594 594
      */
595
-    public static function getGroups (): array {
595
+    public static function getGroups(): array {
596 596
         return self::$ids['groups'] ?? [];
597 597
     }
598 598
 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
      *
602 602
      * @return int[]
603 603
      */
604
-    public static function getSuperGroups (): array {
604
+    public static function getSuperGroups(): array {
605 605
         return self::$ids['supergroups'] ?? [];
606 606
     }
607 607
 
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
      *
611 611
      * @return int[]
612 612
      */
613
-    public static function getChannels (): array {
613
+    public static function getChannels(): array {
614 614
         return self::$ids['channels'] ?? [];
615 615
     }
616 616
 }
Please login to merge, or discard this patch.
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
-            else {
454
+            } else {
475 455
                 if ($old_user->status === chatMemberStatus::LEFT || $old_user->status === chatMemberStatus::KICKED) {
476 456
                     self::$group_user->presence = true;
477 457
                     self::$group_user->removed = false;
@@ -481,8 +461,7 @@  discard block
 block discarded – undo
481 461
                         if (!empty($invite_link)) {
482 462
                             self::$group_user->accepted_by = $by_id;
483 463
                             self::$group_user->invited_by = null;
484
-                        }
485
-                        else {
464
+                        } else {
486 465
                             self::$group_user->invited_by = $by_id;
487 466
                             self::$group_user->accepted_by = null;
488 467
                         }
@@ -501,7 +480,9 @@  discard block
 block discarded – undo
501 480
      * @throws bptException
502 481
      */
503 482
     public static function deleteUser (int $user_id = null): bool {
504
-        if (empty($user_id)) $user_id = telegram::catchFields(fields::USER_ID);
483
+        if (empty($user_id)) {
484
+            $user_id = telegram::catchFields(fields::USER_ID);
485
+        }
505 486
         if (file_exists(self::$folder . '/privates/' . $user_id . '.json')) {
506 487
             unset(self::$ids['privates'][array_search($user_id, self::$ids['privates'])]);
507 488
             sort(self::$ids['privates']);
@@ -522,7 +503,9 @@  discard block
 block discarded – undo
522 503
      * @throws bptException
523 504
      */
524 505
     public static function deleteGroup (int $group_id = null): bool {
525
-        if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID);
506
+        if (empty($group_id)) {
507
+            $group_id = telegram::catchFields(fields::CHAT_ID);
508
+        }
526 509
         if (file_exists(self::$folder . '/groups/' . $group_id . '.json')) {
527 510
             unset(self::$ids['groups'][array_search($group_id, self::$ids['groups'])]);
528 511
             sort(self::$ids['groups']);
@@ -544,7 +527,9 @@  discard block
 block discarded – undo
544 527
      * @throws bptException
545 528
      */
546 529
     public static function deleteSuperGroup (int $group_id = null): bool {
547
-        if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID);
530
+        if (empty($group_id)) {
531
+            $group_id = telegram::catchFields(fields::CHAT_ID);
532
+        }
548 533
         if (file_exists(self::$folder . '/supergroups/' . $group_id . '.json')) {
549 534
             unset(self::$ids['supergroups'][array_search($group_id, self::$ids['supergroups'])]);
550 535
             sort(self::$ids['supergroups']);
@@ -566,7 +551,9 @@  discard block
 block discarded – undo
566 551
      * @throws bptException
567 552
      */
568 553
     public static function deleteChannel (int $channel_id = null): bool {
569
-        if (empty($channel_id)) $channel_id = telegram::catchFields(fields::CHAT_ID);
554
+        if (empty($channel_id)) {
555
+            $channel_id = telegram::catchFields(fields::CHAT_ID);
556
+        }
570 557
         if (file_exists(self::$folder . '/channels/' . $channel_id . '.json')) {
571 558
             unset(self::$ids['channels'][array_search($channel_id, self::$ids['channels'])]);
572 559
             sort(self::$ids['channels']);
Please login to merge, or discard this patch.
src/api/request.php 2 patches
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -450,94 +450,94 @@  discard block
 block discarded – undo
450 450
     ];
451 451
 
452 452
     private const METHODS_KEYS = [
453
-        'getUpdates'                      => ['offset','limit','timeout','allowed_updates','token','return_array','forgot','answer'],
454
-        'setWebhook'                      => ['url','certificate','ip_address','max_connections','allowed_updates','drop_pending_updates','secret_token','token','return_array','forgot','answer'],
455
-        'deleteWebhook'                   => ['drop_pending_updates','token','return_array','forgot','answer'],
456
-        'getWebhookInfo'                  => ['token','return_array','forgot','answer'],
457
-        'getMe'                           => ['token','return_array','forgot','answer'],
458
-        'logOut'                          => ['token','return_array','forgot','answer'],
459
-        'close'                           => ['token','return_array','forgot','answer'],
460
-        'sendMessage'                     => ['text','chat_id','parse_mode','entities','disable_web_page_preview','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
461
-        'forwardMessage'                  => ['chat_id','from_chat_id','disable_notification','protect_content','message_id','token','return_array','forgot','answer'],
462
-        'copyMessage'                     => ['chat_id','from_chat_id','message_id','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
463
-        'sendPhoto'                       => ['photo','chat_id','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
464
-        'sendAudio'                       => ['audio','chat_id','caption','parse_mode','caption_entities','duration','performer','title','thumb','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
465
-        'sendDocument'                    => ['document','chat_id','thumb','caption','parse_mode','caption_entities','disable_content_type_detection','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
466
-        'sendVideo'                       => ['video','chat_id','duration','width','height','thumb','caption','parse_mode','caption_entities','supports_streaming','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
467
-        'sendAnimation'                   => ['animation','chat_id','duration','width','height','thumb','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
468
-        'sendVoice'                       => ['voice','chat_id','caption','parse_mode','caption_entities','duration','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
469
-        'sendVideoNote'                   => ['video_note','chat_id','duration','length','thumb','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
470
-        'sendMediaGroup'                  => ['media','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','token','return_array','forgot','answer'],
471
-        'sendLocation'                    => ['latitude','longitude','chat_id','horizontal_accuracy','live_period','heading','proximity_alert_radius','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
472
-        'editMessageLiveLocation'         => ['latitude','longitude','chat_id','message_id','inline_message_id','horizontal_accuracy','heading','proximity_alert_radius','reply_markup','token','return_array','forgot','answer'],
473
-        'stopMessageLiveLocation'         => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'],
474
-        'sendVenue'                       => ['chat_id','latitude','longitude','title','address','foursquare_id','foursquare_type','google_place_id','google_place_type','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
475
-        'sendContact'                     => ['phone_number','first_name','chat_id','last_name','vcard','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
476
-        'sendPoll'                        => ['question','options','chat_id','is_anonymous','type','allows_multiple_answers','correct_option_id','explanation','explanation_parse_mode','explanation_entities','open_period','close_date','is_closed','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
477
-        'sendDice'                        => ['chat_id','emoji','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
478
-        'sendChatAction'                  => ['chat_id','action','token','return_array','forgot','answer'],
479
-        'getUserProfilePhotos'            => ['user_id','offset','limit','token','return_array','forgot','answer'],
480
-        'getFile'                         => ['file_id','token','return_array','forgot','answer'],
481
-        'banChatMember'                   => ['chat_id','user_id','until_date','revoke_messages','token','return_array','forgot','answer'],
482
-        'unbanChatMember'                 => ['chat_id','user_id','only_if_banned','token','return_array','forgot','answer'],
483
-        'restrictChatMember'              => ['permissions','chat_id','user_id','until_date','token','return_array','forgot','answer'],
484
-        'promoteChatMember'               => ['chat_id','user_id','is_anonymous','can_manage_chat','can_post_messages','can_edit_messages','can_delete_messages','can_manage_video_chats','can_restrict_members','can_promote_members','can_change_info','can_invite_users','can_pin_messages','token','return_array','forgot','answer'],
485
-        'setChatAdministratorCustomTitle' => ['custom_title','chat_id','user_id','token','return_array','forgot','answer'],
486
-        'banChatSenderChat'               => ['sender_chat_id','chat_id','token','return_array','forgot','answer'],
487
-        'unbanChatSenderChat'             => ['sender_chat_id','chat_id','token','return_array','forgot','answer'],
488
-        'setChatPermissions'              => ['permissions','chat_id','token','return_array','forgot','answer'],
489
-        'exportChatInviteLink'            => ['chat_id','token','return_array','forgot','answer'],
490
-        'createChatInviteLink'            => ['chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'],
491
-        'editChatInviteLink'              => ['invite_link','chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'],
492
-        'revokeChatInviteLink'            => ['invite_link','chat_id','token','return_array','forgot','answer'],
493
-        'approveChatJoinRequest'          => ['chat_id','user_id','token','return_array','forgot','answer'],
494
-        'declineChatJoinRequest'          => ['chat_id','user_id','token','return_array','forgot','answer'],
495
-        'setChatPhoto'                    => ['photo','chat_id','token','return_array','forgot','answer'],
496
-        'deleteChatPhoto'                 => ['chat_id','token','return_array','forgot','answer'],
497
-        'setChatTitle'                    => ['title','chat_id','token','return_array','forgot','answer'],
498
-        'setChatDescription'              => ['chat_id','description','token','return_array','forgot','answer'],
499
-        'pinChatMessage'                  => ['message_id','chat_id','disable_notification','token','return_array','forgot','answer'],
500
-        'unpinChatMessage'                => ['chat_id','message_id','token','return_array','forgot','answer'],
501
-        'unpinAllChatMessages'            => ['chat_id','token','return_array','forgot','answer'],
502
-        'leaveChat'                       => ['chat_id','token','return_array','forgot','answer'],
503
-        'getChat'                         => ['chat_id','token','return_array','forgot','answer'],
504
-        'getChatAdministrators'           => ['chat_id','token','return_array','forgot','answer'],
505
-        'getChatMemberCount'              => ['chat_id','token','return_array','forgot','answer'],
506
-        'getChatMember'                   => ['chat_id','user_id','token','return_array','forgot','answer'],
507
-        'setChatStickerSet'               => ['sticker_set_name','chat_id','token','return_array','forgot','answer'],
508
-        'deleteChatStickerSet'            => ['chat_id','token','return_array','forgot','answer'],
509
-        'answerCallbackQuery'             => ['callback_query_id','text','show_alert','url','cache_time','token','return_array','forgot','answer'],
510
-        'setMyCommands'                   => ['commands','scope','language_code','token','return_array','forgot','answer'],
511
-        'deleteMyCommands'                => ['scope','language_code','token','return_array','forgot','answer'],
512
-        'getMyCommands'                   => ['scope','language_code','token','return_array','forgot','answer'],
513
-        'setChatMenuButton'               => ['chat_id','menu_button','token','return_array','forgot','answer'],
514
-        'getChatMenuButton'               => ['chat_id','token','return_array','forgot','answer'],
515
-        'setMyDefaultAdministratorRights' => ['rights','for_channels','token','return_array','forgot','answer'],
516
-        'getMyDefaultAdministratorRights' => ['for_channels','token','return_array','forgot','answer'],
517
-        'editMessageText'                 => ['text','chat_id','message_id','inline_message_id','parse_mode','entities','disable_web_page_preview','reply_markup','token','return_array','forgot','answer'],
518
-        'editMessageCaption'              => ['chat_id','message_id','inline_message_id','caption','parse_mode','caption_entities','reply_markup','token','return_array','forgot','answer'],
519
-        'editMessageMedia'                => ['media','chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'],
520
-        'editMessageReplyMarkup'          => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'],
521
-        'stopPoll'                        => ['chat_id','message_id','reply_markup','token','return_array','forgot','answer'],
522
-        'deleteMessage'                   => ['chat_id','message_id','token','return_array','forgot','answer'],
523
-        'sendSticker'                     => ['sticker','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
524
-        'getStickerSet'                   => ['name','token','return_array','forgot','answer'],
525
-        'uploadStickerFile'               => ['png_sticker','user_id','token','return_array','forgot','answer'],
526
-        'createNewStickerSet'             => ['name','title','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','contains_masks','mask_position','token','return_array','forgot','answer'],
527
-        'addStickerToSet'                 => ['name','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','mask_position','token','return_array','forgot','answer'],
528
-        'setStickerPositionInSet'         => ['sticker','position','token','return_array','forgot','answer'],
529
-        'deleteStickerFromSet'            => ['sticker','token','return_array','forgot','answer'],
530
-        'setStickerSetThumb'              => ['name','user_id','thumb','token','return_array','forgot','answer'],
531
-        'answerInlineQuery'               => ['results','inline_query_id','cache_time','is_personal','next_offset','switch_pm_text','switch_pm_parameter','token','return_array','forgot','answer'],
532
-        'answerWebAppQuery'               => ['web_app_query_id','result','token','return_array','forgot','answer'],
533
-        'sendInvoice'                     => ['title','description','payload','provider_token','currency','prices','chat_id','max_tip_amount','suggested_tip_amounts','start_parameter','provider_data','photo_url','photo_size','photo_width','photo_height','need_name','need_phone_number','need_email','need_shipping_address','send_phone_number_to_provider','send_email_to_provider','is_flexible','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
534
-        'createInvoiceLink'               => ['title','description','payload','provider_token','currency','prices','max_tip_amount','suggested_tip_amounts','provider_data','photo_url','photo_size','photo_width','photo_height','need_name','need_phone_number','need_email','need_shipping_address','send_phone_number_to_provider','send_email_to_provider','is_flexible','token','return_array','forgot','answer'],
535
-        'answerShippingQuery'             => ['ok','shipping_query_id','shipping_options','error_message','token','return_array','forgot','answer'],
536
-        'answerPreCheckoutQuery'          => ['ok','pre_checkout_query_id','error_message','token','return_array','forgot','answer'],
537
-        'setPassportDataErrors'           => ['errors','user_id','token','return_array','forgot','answer'],
538
-        'sendGame'                        => ['game_short_name','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
539
-        'setGameScore'                    => ['score','user_id','force','disable_edit_message','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'],
540
-        'getGameHighScores'               => ['user_id','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'],
453
+        'getUpdates'                      => ['offset', 'limit', 'timeout', 'allowed_updates', 'token', 'return_array', 'forgot', 'answer'],
454
+        'setWebhook'                      => ['url', 'certificate', 'ip_address', 'max_connections', 'allowed_updates', 'drop_pending_updates', 'secret_token', 'token', 'return_array', 'forgot', 'answer'],
455
+        'deleteWebhook'                   => ['drop_pending_updates', 'token', 'return_array', 'forgot', 'answer'],
456
+        'getWebhookInfo'                  => ['token', 'return_array', 'forgot', 'answer'],
457
+        'getMe'                           => ['token', 'return_array', 'forgot', 'answer'],
458
+        'logOut'                          => ['token', 'return_array', 'forgot', 'answer'],
459
+        'close'                           => ['token', 'return_array', 'forgot', 'answer'],
460
+        'sendMessage'                     => ['text', 'chat_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
461
+        'forwardMessage'                  => ['chat_id', 'from_chat_id', 'disable_notification', 'protect_content', 'message_id', 'token', 'return_array', 'forgot', 'answer'],
462
+        'copyMessage'                     => ['chat_id', 'from_chat_id', 'message_id', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
463
+        'sendPhoto'                       => ['photo', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
464
+        'sendAudio'                       => ['audio', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'duration', 'performer', 'title', 'thumb', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
465
+        'sendDocument'                    => ['document', 'chat_id', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'disable_content_type_detection', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
466
+        'sendVideo'                       => ['video', 'chat_id', 'duration', 'width', 'height', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'supports_streaming', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
467
+        'sendAnimation'                   => ['animation', 'chat_id', 'duration', 'width', 'height', 'thumb', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
468
+        'sendVoice'                       => ['voice', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'duration', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
469
+        'sendVideoNote'                   => ['video_note', 'chat_id', 'duration', 'length', 'thumb', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
470
+        'sendMediaGroup'                  => ['media', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'token', 'return_array', 'forgot', 'answer'],
471
+        'sendLocation'                    => ['latitude', 'longitude', 'chat_id', 'horizontal_accuracy', 'live_period', 'heading', 'proximity_alert_radius', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
472
+        'editMessageLiveLocation'         => ['latitude', 'longitude', 'chat_id', 'message_id', 'inline_message_id', 'horizontal_accuracy', 'heading', 'proximity_alert_radius', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
473
+        'stopMessageLiveLocation'         => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
474
+        'sendVenue'                       => ['chat_id', 'latitude', 'longitude', 'title', 'address', 'foursquare_id', 'foursquare_type', 'google_place_id', 'google_place_type', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
475
+        'sendContact'                     => ['phone_number', 'first_name', 'chat_id', 'last_name', 'vcard', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
476
+        'sendPoll'                        => ['question', 'options', 'chat_id', 'is_anonymous', 'type', 'allows_multiple_answers', 'correct_option_id', 'explanation', 'explanation_parse_mode', 'explanation_entities', 'open_period', 'close_date', 'is_closed', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
477
+        'sendDice'                        => ['chat_id', 'emoji', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
478
+        'sendChatAction'                  => ['chat_id', 'action', 'token', 'return_array', 'forgot', 'answer'],
479
+        'getUserProfilePhotos'            => ['user_id', 'offset', 'limit', 'token', 'return_array', 'forgot', 'answer'],
480
+        'getFile'                         => ['file_id', 'token', 'return_array', 'forgot', 'answer'],
481
+        'banChatMember'                   => ['chat_id', 'user_id', 'until_date', 'revoke_messages', 'token', 'return_array', 'forgot', 'answer'],
482
+        'unbanChatMember'                 => ['chat_id', 'user_id', 'only_if_banned', 'token', 'return_array', 'forgot', 'answer'],
483
+        'restrictChatMember'              => ['permissions', 'chat_id', 'user_id', 'until_date', 'token', 'return_array', 'forgot', 'answer'],
484
+        'promoteChatMember'               => ['chat_id', 'user_id', 'is_anonymous', 'can_manage_chat', 'can_post_messages', 'can_edit_messages', 'can_delete_messages', 'can_manage_video_chats', 'can_restrict_members', 'can_promote_members', 'can_change_info', 'can_invite_users', 'can_pin_messages', 'token', 'return_array', 'forgot', 'answer'],
485
+        'setChatAdministratorCustomTitle' => ['custom_title', 'chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
486
+        'banChatSenderChat'               => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
487
+        'unbanChatSenderChat'             => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
488
+        'setChatPermissions'              => ['permissions', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
489
+        'exportChatInviteLink'            => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
490
+        'createChatInviteLink'            => ['chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'],
491
+        'editChatInviteLink'              => ['invite_link', 'chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'],
492
+        'revokeChatInviteLink'            => ['invite_link', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
493
+        'approveChatJoinRequest'          => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
494
+        'declineChatJoinRequest'          => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
495
+        'setChatPhoto'                    => ['photo', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
496
+        'deleteChatPhoto'                 => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
497
+        'setChatTitle'                    => ['title', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
498
+        'setChatDescription'              => ['chat_id', 'description', 'token', 'return_array', 'forgot', 'answer'],
499
+        'pinChatMessage'                  => ['message_id', 'chat_id', 'disable_notification', 'token', 'return_array', 'forgot', 'answer'],
500
+        'unpinChatMessage'                => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'],
501
+        'unpinAllChatMessages'            => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
502
+        'leaveChat'                       => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
503
+        'getChat'                         => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
504
+        'getChatAdministrators'           => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
505
+        'getChatMemberCount'              => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
506
+        'getChatMember'                   => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
507
+        'setChatStickerSet'               => ['sticker_set_name', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
508
+        'deleteChatStickerSet'            => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
509
+        'answerCallbackQuery'             => ['callback_query_id', 'text', 'show_alert', 'url', 'cache_time', 'token', 'return_array', 'forgot', 'answer'],
510
+        'setMyCommands'                   => ['commands', 'scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'],
511
+        'deleteMyCommands'                => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'],
512
+        'getMyCommands'                   => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'],
513
+        'setChatMenuButton'               => ['chat_id', 'menu_button', 'token', 'return_array', 'forgot', 'answer'],
514
+        'getChatMenuButton'               => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
515
+        'setMyDefaultAdministratorRights' => ['rights', 'for_channels', 'token', 'return_array', 'forgot', 'answer'],
516
+        'getMyDefaultAdministratorRights' => ['for_channels', 'token', 'return_array', 'forgot', 'answer'],
517
+        'editMessageText'                 => ['text', 'chat_id', 'message_id', 'inline_message_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
518
+        'editMessageCaption'              => ['chat_id', 'message_id', 'inline_message_id', 'caption', 'parse_mode', 'caption_entities', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
519
+        'editMessageMedia'                => ['media', 'chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
520
+        'editMessageReplyMarkup'          => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
521
+        'stopPoll'                        => ['chat_id', 'message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
522
+        'deleteMessage'                   => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'],
523
+        'sendSticker'                     => ['sticker', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
524
+        'getStickerSet'                   => ['name', 'token', 'return_array', 'forgot', 'answer'],
525
+        'uploadStickerFile'               => ['png_sticker', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
526
+        'createNewStickerSet'             => ['name', 'title', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'contains_masks', 'mask_position', 'token', 'return_array', 'forgot', 'answer'],
527
+        'addStickerToSet'                 => ['name', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'mask_position', 'token', 'return_array', 'forgot', 'answer'],
528
+        'setStickerPositionInSet'         => ['sticker', 'position', 'token', 'return_array', 'forgot', 'answer'],
529
+        'deleteStickerFromSet'            => ['sticker', 'token', 'return_array', 'forgot', 'answer'],
530
+        'setStickerSetThumb'              => ['name', 'user_id', 'thumb', 'token', 'return_array', 'forgot', 'answer'],
531
+        'answerInlineQuery'               => ['results', 'inline_query_id', 'cache_time', 'is_personal', 'next_offset', 'switch_pm_text', 'switch_pm_parameter', 'token', 'return_array', 'forgot', 'answer'],
532
+        'answerWebAppQuery'               => ['web_app_query_id', 'result', 'token', 'return_array', 'forgot', 'answer'],
533
+        'sendInvoice'                     => ['title', 'description', 'payload', 'provider_token', 'currency', 'prices', 'chat_id', 'max_tip_amount', 'suggested_tip_amounts', 'start_parameter', 'provider_data', 'photo_url', 'photo_size', 'photo_width', 'photo_height', 'need_name', 'need_phone_number', 'need_email', 'need_shipping_address', 'send_phone_number_to_provider', 'send_email_to_provider', 'is_flexible', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
534
+        'createInvoiceLink'               => ['title', 'description', 'payload', 'provider_token', 'currency', 'prices', 'max_tip_amount', 'suggested_tip_amounts', 'provider_data', 'photo_url', 'photo_size', 'photo_width', 'photo_height', 'need_name', 'need_phone_number', 'need_email', 'need_shipping_address', 'send_phone_number_to_provider', 'send_email_to_provider', 'is_flexible', 'token', 'return_array', 'forgot', 'answer'],
535
+        'answerShippingQuery'             => ['ok', 'shipping_query_id', 'shipping_options', 'error_message', 'token', 'return_array', 'forgot', 'answer'],
536
+        'answerPreCheckoutQuery'          => ['ok', 'pre_checkout_query_id', 'error_message', 'token', 'return_array', 'forgot', 'answer'],
537
+        'setPassportDataErrors'           => ['errors', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
538
+        'sendGame'                        => ['game_short_name', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
539
+        'setGameScore'                    => ['score', 'user_id', 'force', 'disable_edit_message', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'],
540
+        'getGameHighScores'               => ['user_id', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'],
541 541
     ];
542 542
 
543 543
     private const METHODS_WITH_FILE = [
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
         'logOut'                          => [],
567 567
         'close'                           => [],
568 568
         'sendMessage'                     => ['chat_id'],
569
-        'forwardMessage'                  => ['from_chat_id','message_id'],
570
-        'copyMessage'                     => ['from_chat_id','message_id'],
569
+        'forwardMessage'                  => ['from_chat_id', 'message_id'],
570
+        'copyMessage'                     => ['from_chat_id', 'message_id'],
571 571
         'sendPhoto'                       => ['chat_id'],
572 572
         'sendAudio'                       => ['chat_id'],
573 573
         'sendDocument'                    => ['chat_id'],
@@ -583,15 +583,15 @@  discard block
 block discarded – undo
583 583
         'sendContact'                     => ['chat_id'],
584 584
         'sendPoll'                        => ['chat_id'],
585 585
         'sendDice'                        => ['chat_id'],
586
-        'sendChatAction'                  => ['chat_id','action'],
586
+        'sendChatAction'                  => ['chat_id', 'action'],
587 587
         'getUserProfilePhotos'            => ['user_id'],
588 588
         'getFile'                         => ['file_id'],
589
-        'banChatMember'                   => ['chat_id','user_id'],
590
-        'kickChatMember'                  => ['chat_id','user_id'],
591
-        'unbanChatMember'                 => ['chat_id','user_id'],
592
-        'restrictChatMember'              => ['chat_id','user_id'],
593
-        'promoteChatMember'               => ['chat_id','user_id'],
594
-        'setChatAdministratorCustomTitle' => ['chat_id','user_id'],
589
+        'banChatMember'                   => ['chat_id', 'user_id'],
590
+        'kickChatMember'                  => ['chat_id', 'user_id'],
591
+        'unbanChatMember'                 => ['chat_id', 'user_id'],
592
+        'restrictChatMember'              => ['chat_id', 'user_id'],
593
+        'promoteChatMember'               => ['chat_id', 'user_id'],
594
+        'setChatAdministratorCustomTitle' => ['chat_id', 'user_id'],
595 595
         'banChatSenderChat'               => ['chat_id'],
596 596
         'unbanChatSenderChat'             => ['chat_id'],
597 597
         'setChatPermissions'              => ['chat_id'],
@@ -599,8 +599,8 @@  discard block
 block discarded – undo
599 599
         'createChatInviteLink'            => ['chat_id'],
600 600
         'editChatInviteLink'              => ['chat_id'],
601 601
         'revokeChatInviteLink'            => ['chat_id'],
602
-        'approveChatJoinRequest'          => ['chat_id','user_id'],
603
-        'declineChatJoinRequest'          => ['chat_id','user_id'],
602
+        'approveChatJoinRequest'          => ['chat_id', 'user_id'],
603
+        'declineChatJoinRequest'          => ['chat_id', 'user_id'],
604 604
         'setChatPhoto'                    => ['chat_id'],
605 605
         'deleteChatPhoto'                 => ['chat_id'],
606 606
         'setChatTitle'                    => ['chat_id'],
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         'getChat'                         => ['chat_id'],
613 613
         'getChatAdministrators'           => ['chat_id'],
614 614
         'getChatMembersCount'             => ['chat_id'],
615
-        'getChatMember'                   => ['chat_id','user_id'],
615
+        'getChatMember'                   => ['chat_id', 'user_id'],
616 616
         'setChatStickerSet'               => ['chat_id'],
617 617
         'deleteChatStickerSet'            => ['chat_id'],
618 618
         'answerCallbackQuery'             => ['callback_query_id'],
@@ -623,12 +623,12 @@  discard block
 block discarded – undo
623 623
         'getChatMenuButton'               => [],
624 624
         'setMyDefaultAdministratorRights' => [],
625 625
         'getMyDefaultAdministratorRights' => [],
626
-        'editMessageText'                 => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
627
-        'editMessageCaption'              => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
628
-        'editMessageMedia'                => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
629
-        'editMessageReplyMarkup'          => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
630
-        'stopPoll'                        => ['chat_id','message_id'],
631
-        'deleteMessage'                   => ['chat_id','message_id'],
626
+        'editMessageText'                 => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
627
+        'editMessageCaption'              => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
628
+        'editMessageMedia'                => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
629
+        'editMessageReplyMarkup'          => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
630
+        'stopPoll'                        => ['chat_id', 'message_id'],
631
+        'deleteMessage'                   => ['chat_id', 'message_id'],
632 632
         'sendSticker'                     => ['chat_id'],
633 633
         'getStickerSet'                   => [],
634 634
         'uploadStickerFile'               => ['user_id'],
@@ -644,8 +644,8 @@  discard block
 block discarded – undo
644 644
         'answerPreCheckoutQuery'          => ['pre_checkout_query_id'],
645 645
         'setPassportDataErrors'           => ['user_id'],
646 646
         'sendGame'                        => ['chat_id'],
647
-        'setGameScore'                    => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
648
-        'getGameHighScores'               => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']]
647
+        'setGameScore'                    => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
648
+        'getGameHighScores'               => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']]
649 649
     ];
650 650
 
651 651
     private const METHODS_RETURN = [
@@ -697,25 +697,25 @@  discard block
 block discarded – undo
697 697
     ];
698 698
 
699 699
 
700
-    public static function __callStatic (string $name, array $arguments) {
700
+    public static function __callStatic(string $name, array $arguments) {
701 701
         if ($action = self::methodAction($name)) {
702
-            self::keysName($action,$arguments);
703
-            self::readyFile($action,$arguments);
704
-            self::setDefaults($action,$arguments);
702
+            self::keysName($action, $arguments);
703
+            self::readyFile($action, $arguments);
704
+            self::setDefaults($action, $arguments);
705 705
             if (isset($arguments['answer'])) {
706
-                return answer::init($action,$arguments);
706
+                return answer::init($action, $arguments);
707 707
             }
708 708
             else {
709
-                return self::processResponse($action,curl::init($action,$arguments));
709
+                return self::processResponse($action, curl::init($action, $arguments));
710 710
             }
711 711
         }
712 712
         else {
713
-            logger::write("$name method is not supported",loggerTypes::ERROR);
713
+            logger::write("$name method is not supported", loggerTypes::ERROR);
714 714
             throw new bptException('METHOD_NOT_FOUND');
715 715
         }
716 716
     }
717 717
 
718
-    private static function keysName (string $name, array &$arguments): void {
718
+    private static function keysName(string $name, array &$arguments): void {
719 719
         foreach ($arguments as $key => $argument) {
720 720
             if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) {
721 721
                 $arguments[self::METHODS_KEYS[$name][$key]] = $argument;
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
         }
725 725
     }
726 726
 
727
-    private static function methodAction(string $name): string|false {
727
+    private static function methodAction(string $name): string | false {
728 728
         return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false;
729 729
     }
730 730
 
@@ -745,11 +745,11 @@  discard block
 block discarded – undo
745 745
         }
746 746
     }
747 747
 
748
-    private static function methodFile(string $name): array|false {
748
+    private static function methodFile(string $name): array | false {
749 749
         return self::METHODS_WITH_FILE[$name] ?? false;
750 750
     }
751 751
 
752
-    private static function methodReturn(string $name,stdClass $response) {
752
+    private static function methodReturn(string $name, stdClass $response) {
753 753
         if (isset(self::METHODS_RETURN[$name])) {
754 754
             $return = self::METHODS_RETURN[$name];
755 755
             if (is_array($return)) {
@@ -772,13 +772,13 @@  discard block
 block discarded – undo
772 772
         $defaults = self::METHODS_EXTRA_DEFAULTS[$name];
773 773
         foreach ($defaults as $key => $default) {
774 774
             if (is_numeric($key)) {
775
-                if (!isset($arguments[$default])){
775
+                if (!isset($arguments[$default])) {
776 776
                     $arguments[$default] = self::catchFields($default);
777 777
                 }
778 778
             }
779 779
             elseif (isset(BPT::$update->$key) || $key === 'other') {
780 780
                 foreach ($default as $def) {
781
-                    if (!isset($arguments[$def])){
781
+                    if (!isset($arguments[$def])) {
782 782
                         $arguments[$def] = self::catchFields($def);
783 783
                     }
784 784
                 }
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
         if ($response->ok) {
792 792
             self::$status = true;
793 793
             self::$pure_response = $response;
794
-            return self::methodReturn($name,$response);
794
+            return self::methodReturn($name, $response);
795 795
         }
796 796
         else {
797 797
             self::$status = false;
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
      *
808 808
      * @return int|string|bool
809 809
      */
810
-    public static function catchFields (string $field): int|string|bool {
810
+    public static function catchFields(string $field): int | string | bool {
811 811
         switch ($field) {
812 812
             case fields::CHAT_ID :
813 813
             case fields::FROM_CHAT_ID :
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
                     default => false
944 944
                 };
945 945
             case fields::URL :
946
-                return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
946
+                return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
947 947
             default:
948 948
                 return false;
949 949
         }
Please login to merge, or discard this patch.
Braces   +14 added lines, -17 removed lines patch added patch discarded remove patch
@@ -704,12 +704,10 @@  discard block
 block discarded – undo
704 704
             self::setDefaults($action,$arguments);
705 705
             if (isset($arguments['answer'])) {
706 706
                 return answer::init($action,$arguments);
707
-            }
708
-            else {
707
+            } else {
709 708
                 return self::processResponse($action,curl::init($action,$arguments));
710 709
             }
711
-        }
712
-        else {
710
+        } else {
713 711
             logger::write("$name method is not supported",loggerTypes::ERROR);
714 712
             throw new bptException('METHOD_NOT_FOUND');
715 713
         }
@@ -735,8 +733,7 @@  discard block
 block discarded – undo
735 733
                     $arguments['media'][$key]['media'] = new CURLFile($media['media']);
736 734
                 }
737 735
             }
738
-        }
739
-        elseif ($file_params = self::methodFile($name)) {
736
+        } elseif ($file_params = self::methodFile($name)) {
740 737
             foreach ($file_params as $param) {
741 738
                 if (isset($arguments[$param]) && file_exists($arguments[$param])) {
742 739
                     $arguments[$param] = new CURLFile($arguments[$param]);
@@ -758,12 +755,10 @@  discard block
 block discarded – undo
758 755
                     $value = new ($return[0]) ($value);
759 756
                 }
760 757
                 return $response;
761
-            }
762
-            else {
758
+            } else {
763 759
                 return new ($return) ($response->result);
764 760
             }
765
-        }
766
-        else {
761
+        } else {
767 762
             return $response->result;
768 763
         }
769 764
     }
@@ -775,8 +770,7 @@  discard block
 block discarded – undo
775 770
                 if (!isset($arguments[$default])){
776 771
                     $arguments[$default] = self::catchFields($default);
777 772
                 }
778
-            }
779
-            elseif (isset(BPT::$update->$key) || $key === 'other') {
773
+            } elseif (isset(BPT::$update->$key) || $key === 'other') {
780 774
                 foreach ($default as $def) {
781 775
                     if (!isset($arguments[$def])){
782 776
                         $arguments[$def] = self::catchFields($def);
@@ -792,8 +786,7 @@  discard block
 block discarded – undo
792 786
             self::$status = true;
793 787
             self::$pure_response = $response;
794 788
             return self::methodReturn($name,$response);
795
-        }
796
-        else {
789
+        } else {
797 790
             self::$status = false;
798 791
             self::$pure_response = $response;
799 792
             return new responseError($response);
@@ -836,9 +829,13 @@  discard block
 block discarded – undo
836 829
                     default => false
837 830
                 };
838 831
             case fields::FILE_ID :
839
-                if (isset(BPT::$update->message)) $type = 'message';
840
-                elseif (isset(BPT::$update->edited_message)) $type = 'edited_message';
841
-                else return false;
832
+                if (isset(BPT::$update->message)) {
833
+                    $type = 'message';
834
+                } elseif (isset(BPT::$update->edited_message)) {
835
+                    $type = 'edited_message';
836
+                } else {
837
+                    return false;
838
+                }
842 839
 
843 840
                 return match(true) {
844 841
                     isset(BPT::$update->$type->animation) => BPT::$update->$type->animation->file_id,
Please login to merge, or discard this patch.