Passed
Push — main ( 7834cc...51b09b )
by Miaad
01:43
created
src/settings.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,11 +78,9 @@
 block discarded – undo
78 78
                     $value = 'bots_files/' . $value . '/';
79 79
                 }
80 80
                 self::$$setting = $value;
81
-            }
82
-            catch (TypeError) {
81
+            } catch (TypeError) {
83 82
                 logger::write("$setting setting has wrong type , its set to default value", loggerTypes::WARNING);
84
-            }
85
-            catch (Error) {
83
+            } catch (Error) {
86 84
                 logger::write("$setting setting is not one of library settings", loggerTypes::WARNING);
87 85
             }
88 86
         }
Please login to merge, or discard this patch.
src/telegram/request.php 1 patch
Braces   +13 added lines, -15 removed lines patch added patch discarded remove patch
@@ -748,8 +748,7 @@  discard block
 block discarded – undo
748 748
         self::setDefaults($action,$arguments);
749 749
         if (isset($arguments['answer'])) {
750 750
             return answer::init($action,$arguments);
751
-        }
752
-        else {
751
+        } else {
753 752
             $result = curl::init($action,$arguments);
754 753
             if (!is_object($result)) {
755 754
                 return false;
@@ -784,8 +783,7 @@  discard block
 block discarded – undo
784 783
                     $arguments['media'][$key]['media'] = new CURLFile($media['media']);
785 784
                 }
786 785
             }
787
-        }
788
-        elseif ($file_params = self::methodFile($name)) {
786
+        } elseif ($file_params = self::methodFile($name)) {
789 787
             foreach ($file_params as $param) {
790 788
                 if (isset($arguments[$param]) && is_string($arguments[$param]) && file_exists($arguments[$param])) {
791 789
                     $arguments[$param] = new CURLFile($arguments[$param]);
@@ -807,12 +805,10 @@  discard block
 block discarded – undo
807 805
                     $value = new ($return[0]) ($value);
808 806
                 }
809 807
                 return $response;
810
-            }
811
-            else {
808
+            } else {
812 809
                 return new ($return) ($response->result);
813 810
             }
814
-        }
815
-        else {
811
+        } else {
816 812
             return $response->result;
817 813
         }
818 814
     }
@@ -824,8 +820,7 @@  discard block
 block discarded – undo
824 820
                 if (!isset($arguments[$default])){
825 821
                     $arguments[$default] = self::catchFields($default);
826 822
                 }
827
-            }
828
-            elseif (isset(BPT::$update->$key) || $key === 'other') {
823
+            } elseif (isset(BPT::$update->$key) || $key === 'other') {
829 824
                 foreach ($default as $def) {
830 825
                     if (!isset($arguments[$def])){
831 826
                         $arguments[$def] = self::catchFields($def);
@@ -841,8 +836,7 @@  discard block
 block discarded – undo
841 836
             self::$status = true;
842 837
             self::$pure_response = $response;
843 838
             return self::methodReturn($name,$response);
844
-        }
845
-        else {
839
+        } else {
846 840
             self::$status = false;
847 841
             self::$pure_response = $response;
848 842
             return new responseError($response);
@@ -885,9 +879,13 @@  discard block
 block discarded – undo
885 879
                     default => false
886 880
                 };
887 881
             case fields::FILE_ID :
888
-                if (isset(BPT::$update->message)) $type = 'message';
889
-                elseif (isset(BPT::$update->edited_message)) $type = 'edited_message';
890
-                else return false;
882
+                if (isset(BPT::$update->message)) {
883
+                    $type = 'message';
884
+                } elseif (isset(BPT::$update->edited_message)) {
885
+                    $type = 'edited_message';
886
+                } else {
887
+                    return false;
888
+                }
891 889
 
892 890
                 return match(true) {
893 891
                     isset(BPT::$update->$type->animation) => BPT::$update->$type->animation->file_id,
Please login to merge, or discard this patch.
src/telegram/telegram.php 1 patch
Braces   +9 added lines, -15 removed lines patch added patch discarded remove patch
@@ -61,28 +61,22 @@
 block discarded – undo
61 61
         $type = tools::fileType($file_id);
62 62
         if ($type === fileTypes::VIDEO) {
63 63
             return self::sendVideo($file_id,$chat_id,$message_thread_id,null,null,null,null,$caption,$parse_mode,$caption_entities,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer);
64
-        }
65
-        elseif ($type === fileTypes::VIDEO_NOTE) {
64
+        } elseif ($type === fileTypes::VIDEO_NOTE) {
66 65
             return self::sendVideoNote($file_id,$chat_id,$message_thread_id,null,null,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer);
67
-        }
68
-        elseif ($type === fileTypes::ANIMATION) {
66
+        } elseif ($type === fileTypes::ANIMATION) {
69 67
             return self::sendAnimation($file_id,$chat_id,$message_thread_id,null,null,null,null,$caption,$parse_mode,$caption_entities,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer);
70
-        }
71
-        elseif ($type === fileTypes::AUDIO) {
68
+        } elseif ($type === fileTypes::AUDIO) {
72 69
             return self::sendAudio($file_id,$chat_id,$message_thread_id,$caption,$parse_mode,$caption_entities,null,null,null,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer);
73
-        }
74
-        elseif ($type === fileTypes::PHOTO || $type === fileTypes::PROFILE_PHOTO) {
70
+        } elseif ($type === fileTypes::PHOTO || $type === fileTypes::PROFILE_PHOTO) {
75 71
             return self::sendPhoto($file_id,$chat_id,$message_thread_id,$caption,$parse_mode,$caption_entities,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer);
76
-        }
77
-        elseif ($type === fileTypes::VOICE) {
72
+        } elseif ($type === fileTypes::VOICE) {
78 73
             return self::sendVoice($file_id,$chat_id,$message_thread_id,$caption,$parse_mode,$caption_entities,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer);
79
-        }
80
-        elseif ($type === fileTypes::STICKER) {
74
+        } elseif ($type === fileTypes::STICKER) {
81 75
             return self::sendSticker($file_id,$chat_id,$message_thread_id,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer);
82
-        }
83
-        elseif ($type === fileTypes::DOCUMENT) {
76
+        } elseif ($type === fileTypes::DOCUMENT) {
84 77
             return self::sendDocument($file_id,$chat_id,$message_thread_id,null,$caption,$parse_mode,$caption_entities,null,$disable_notification,$protect_content,$reply_to_message_id,$allow_sending_without_reply,$reply_markup,$token,$forgot,$answer);
78
+        } else {
79
+            return false;
85 80
         }
86
-        else return false;
87 81
     }
88 82
 }
89 83
\ No newline at end of file
Please login to merge, or discard this patch.
src/receiver/getUpdates.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@
 block discarded – undo
35 35
     private static function loadData(): bool|int|string {
36 36
         if (lock::exist('getUpdate')) {
37 37
             $last_update_id = lock::read('getUpdate');
38
-        }
39
-        else {
38
+        } else {
40 39
             self::deleteOldLocks();
41 40
             telegram::deleteWebhook();
42 41
             $last_update_id = 0;
Please login to merge, or discard this patch.
src/receiver/webhook.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,15 +23,13 @@  discard block
 block discarded – undo
23 23
     public static function init () {
24 24
         if (settings::$multi) {
25 25
             multi::init();
26
-        }
27
-        else {
26
+        } else {
28 27
             if (lock::exist('BPT-HOOK')) {
29 28
                 receiver::telegramVerify();
30 29
                 self::checkSecret();
31 30
                 logger::write('Update received , lets process it ;)');
32 31
                 receiver::processUpdate();
33
-            }
34
-            else {
32
+            } else {
35 33
                 self::processSetWebhook();
36 34
             }
37 35
         }
@@ -74,8 +72,7 @@  discard block
 block discarded – undo
74 72
             if (is_string(settings::$certificate)) {
75 73
                 if (file_exists(settings::$certificate)) {
76 74
                     settings::$certificate = new CURLFile(settings::$certificate);
77
-                }
78
-                else {
75
+                } else {
79 76
                     settings::$certificate = null;
80 77
                 }
81 78
             }
Please login to merge, or discard this patch.
src/tools.php 1 patch
Braces   +34 added lines, -32 removed lines patch added patch discarded remove patch
@@ -217,8 +217,9 @@  discard block
 block discarded – undo
217 217
             if (telegram::$status) {
218 218
                 $check = $check->status;
219 219
                 $result[$id] = $check !== chatMemberStatus::LEFT && $check !== chatMemberStatus::KICKED;
220
+            } else {
221
+                $result[$id] = null;
220 222
             }
221
-            else $result[$id] = null;
222 223
         }
223 224
         return $result;
224 225
     }
@@ -259,8 +260,7 @@  discard block
 block discarded – undo
259 260
             curl_exec($ch);
260 261
             $size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
261 262
             curl_close($ch);
262
-        }
263
-        else {
263
+        } else {
264 264
             $size = file_exists($path) ? filesize($path) : false;
265 265
         }
266 266
         if (isset($size) && is_numeric($size)) {
@@ -329,8 +329,7 @@  discard block
 block discarded – undo
329 329
                     $zip->addFile($filePath, substr($filePath, $root_len));
330 330
                 }
331 331
             }
332
-        }
333
-        else {
332
+        } else {
334 333
             $zip->addFile($path, basename($path));
335 334
         }
336 335
         return $zip->close();
@@ -349,9 +348,13 @@  discard block
 block discarded – undo
349 348
      */
350 349
     public static function downloadFile (string $url, string $path,int $chunk_size = 512): bool {
351 350
         $file = fopen($url, 'rb');
352
-        if (!$file) return false;
351
+        if (!$file) {
352
+            return false;
353
+        }
353 354
         $path = fopen($path, 'wb');
354
-        if (!$path) return false;
355
+        if (!$path) {
356
+            return false;
357
+        }
355 358
 
356 359
         $length = $chunk_size * 1024;
357 360
         while (!feof($file)){
@@ -460,8 +463,9 @@  discard block
 block discarded – undo
460 463
         foreach ($string as $k => &$v) {
461 464
             if ($diff->$v) {
462 465
                 $v = $diff->$v;
466
+            } else {
467
+                unset($string[$k]);
463 468
             }
464
-            else unset($string[$k]);
465 469
         }
466 470
         $string['status'] = $base_time < $target_time ? 'later' : 'ago';
467 471
 
@@ -527,8 +531,7 @@  discard block
 block discarded – undo
527 531
             if ($last === "\0") {
528 532
                 $new .= str_repeat($last, ord($char));
529 533
                 $last = '';
530
-            }
531
-            else {
534
+            } else {
532 535
                 $new .= $last;
533 536
                 $last = $char;
534 537
             }
@@ -612,7 +615,9 @@  discard block
 block discarded – undo
612 615
             }
613 616
             $rows = [];
614 617
             foreach ($keyboard as $row) {
615
-                if (!is_array($row)) continue;
618
+                if (!is_array($row)) {
619
+                    continue;
620
+                }
616 621
                 $buttons = [];
617 622
                 foreach ($row as $base_button) {
618 623
                     $button_info = explode('||', $base_button);
@@ -621,15 +626,12 @@  discard block
 block discarded – undo
621 626
                     if (count($button_info) > 1) {
622 627
                         if ($button_info[1] === 'con') {
623 628
                             $button->setRequest_contact(true);
624
-                        }
625
-                        elseif ($button_info[1] === 'loc') {
629
+                        } elseif ($button_info[1] === 'loc') {
626 630
                             $button->setRequest_location(true);
627
-                        }
628
-                        elseif ($button_info[1] === 'poll') {
631
+                        } elseif ($button_info[1] === 'poll') {
629 632
                             $type = $button_info[2] === pollType::QUIZ ? pollType::QUIZ : pollType::REGULAR;
630 633
                             $button->setRequest_poll((new keyboardButtonPollType())->setType($type));
631
-                        }
632
-                        elseif ($button_info[1] === 'web' && isset($button_info[2])) {
634
+                        } elseif ($button_info[1] === 'web' && isset($button_info[2])) {
633 635
                             $url = $button_info[2];
634 636
                             $button->setWeb_app((new webAppInfo())->setUrl($url));
635 637
                         }
@@ -640,8 +642,7 @@  discard block
 block discarded – undo
640 642
             }
641 643
             $keyboard_object->setKeyboard($rows);
642 644
             return $keyboard_object;
643
-        }
644
-        elseif (!empty($inline)) {
645
+        } elseif (!empty($inline)) {
645 646
             $keyboard_object = new inlineKeyboardMarkup();
646 647
             $rows = [];
647 648
             foreach ($inline as $row) {
@@ -651,12 +652,10 @@  discard block
 block discarded – undo
651 652
                     if (isset($button_info[1])) {
652 653
                         if (filter_var($button_info[1], FILTER_VALIDATE_URL) && str_starts_with($button_info[1], 'http')) {
653 654
                             $button->setText($button_info[0])->setUrl($button_info[1]);
654
-                        }
655
-                        else {
655
+                        } else {
656 656
                             $button->setText($button_info[0])->setCallback_data($button_info[1]);
657 657
                         }
658
-                    }
659
-                    else {
658
+                    } else {
660 659
                         $button->setText($button_info[0])->setUrl('https://t.me/BPT_CH');
661 660
                     }
662 661
                     $buttons[] = $button;
@@ -665,8 +664,7 @@  discard block
 block discarded – undo
665 664
             }
666 665
             $keyboard_object->setInline_keyboard($rows);
667 666
             return $keyboard_object;
668
-        }
669
-        else {
667
+        } else {
670 668
             logger::write("tools::eKey function used\nkeyboard or inline parameter must be set",loggerTypes::ERROR);
671 669
             throw new bptException('ARGUMENT_NOT_FOUND_KEYBOARD_INLINE');
672 670
         }
@@ -685,8 +683,12 @@  discard block
 block discarded – undo
685 683
      * @return string
686 684
      */
687 685
     public static function inviteLink (int $user_id = null, string $bot_username = null): string {
688
-        if (empty($user_id)) $user_id = telegram::catchFields(fields::USER_ID);
689
-        if (empty($bot_username)) $bot_username = telegram::getMe()->username;
686
+        if (empty($user_id)) {
687
+            $user_id = telegram::catchFields(fields::USER_ID);
688
+        }
689
+        if (empty($bot_username)) {
690
+            $bot_username = telegram::getMe()->username;
691
+        }
690 692
         return 'https://t.me/' . str_replace('@', '', $bot_username) . '?start=ref_' . tools::shortEncode($user_id);
691 693
     }
692 694
 
@@ -721,8 +723,7 @@  discard block
 block discarded – undo
721 723
             $iv = self::randomString();
722 724
             $output = base64_encode(openssl_encrypt($text, 'AES-256-CBC', $key, 1, $iv));
723 725
             return ['hash' => $output, 'key' => $key, 'iv' => $iv];
724
-        }
725
-        elseif ($action === cryptoAction::DECRYPT) {
726
+        } elseif ($action === cryptoAction::DECRYPT) {
726 727
             if (empty($key)) {
727 728
                 logger::write("tools::crypto function used\nkey parameter is not set",loggerTypes::ERROR);
728 729
                 throw new bptException('ARGUMENT_NOT_FOUND_KEY');
@@ -732,8 +733,7 @@  discard block
 block discarded – undo
732 733
                 throw new bptException('ARGUMENT_NOT_FOUND_IV');
733 734
             }
734 735
             return openssl_decrypt(base64_decode($text), 'AES-256-CBC', $key, 1, $iv);
735
-        }
736
-        else {
736
+        } else {
737 737
             logger::write("tools::crypto function used\naction is not right, its must be `encode` or `decode`",loggerTypes::WARNING);
738 738
             return false;
739 739
         }
@@ -755,7 +755,9 @@  discard block
 block discarded – undo
755 755
             $array[] = $num % 62;
756 756
             $num = floor($num / 62);
757 757
         }
758
-        if (count($array) < 1) $array = [0];
758
+        if (count($array) < 1) {
759
+            $array = [0];
760
+        }
759 761
         foreach ($array as &$value) {
760 762
             $value = $codes[$value];
761 763
         }
Please login to merge, or discard this patch.
src/database/mysql.php 1 patch
Braces   +16 added lines, -19 removed lines patch added patch discarded remove patch
@@ -65,17 +65,13 @@  discard block
 block discarded – undo
65 65
     public static function process (): void {
66 66
         if (isset(BPT::$update->message)) {
67 67
             self::processMessage(BPT::$update->message);
68
-        }
69
-        elseif (isset(BPT::$update->edited_message)) {
68
+        } elseif (isset(BPT::$update->edited_message)) {
70 69
             self::processMessage(BPT::$update->edited_message);
71
-        }
72
-        elseif (isset(BPT::$update->callback_query)) {
70
+        } elseif (isset(BPT::$update->callback_query)) {
73 71
             self::processCallbackQuery(BPT::$update->callback_query);
74
-        }
75
-        elseif (isset(BPT::$update->inline_query)) {
72
+        } elseif (isset(BPT::$update->inline_query)) {
76 73
             self::processInlineQuery(BPT::$update->inline_query);
77
-        }
78
-        elseif (isset(BPT::$update->my_chat_member)) {
74
+        } elseif (isset(BPT::$update->my_chat_member)) {
79 75
             self::processMyChatMember(BPT::$update->my_chat_member);
80 76
         }
81 77
     }
@@ -131,8 +127,7 @@  discard block
 block discarded – undo
131 127
         if ($type === chatType::PRIVATE) {
132 128
             if ($update->new_chat_member->status === chatMemberStatus::MEMBER) {
133 129
                 self::update('users', ['blocked' => false], ['id' => $update->from->id], 1);
134
-            }
135
-            else {
130
+            } else {
136 131
                 self::update('users', ['blocked' => true], ['id' => $update->from->id], 1);
137 132
             }
138 133
         }
@@ -219,8 +214,7 @@  discard block
 block discarded – undo
219 214
         foreach ($array as $name => $value) {
220 215
             if ($first) {
221 216
                 $first = false;
222
-            }
223
-            else {
217
+            } else {
224 218
                 $query .= $operator;
225 219
             }
226 220
             $query .= " `$name` = ?";
@@ -237,8 +231,7 @@  discard block
 block discarded – undo
237 231
         }
238 232
         if (!empty($count)) {
239 233
             $query .= !empty($offset) ? " LIMIT $offset,$count" : " LIMIT $count";
240
-        }
241
-        elseif (!empty($offset)) {
234
+        } elseif (!empty($offset)) {
242 235
             $query .= " OFFSET $offset";
243 236
         }
244 237
         return $values;
@@ -296,7 +289,9 @@  discard block
 block discarded – undo
296 289
     public static function insert (string $table, string|array $columns, array|string $values): mysqli_result|bool {
297 290
         $query = "INSERT INTO `$table`(";
298 291
         $query .= '`' . (is_string($columns) ? $columns : implode('`,`', $columns)) . '`) VALUES (';
299
-        if (is_string($values)) $values = [$values];
292
+        if (is_string($values)) {
293
+            $values = [$values];
294
+        }
300 295
         $query .= '?' . str_repeat(',?', count($values) - 1) . ')';
301 296
         return self::query($query, $values, false);
302 297
     }
@@ -319,8 +314,7 @@  discard block
 block discarded – undo
319 314
         $query = "SELECT ";
320 315
         if ($columns == '*') {
321 316
             $query .= "* ";
322
-        }
323
-        else {
317
+        } else {
324 318
             $query .= '`' . (is_string($columns) ? $columns : implode('`,`', $columns)) . '` ';
325 319
         }
326 320
         $query .= "FROM `$table`";
@@ -381,8 +375,11 @@  discard block
 block discarded – undo
381 375
     public static function selectEach (string $table, array|string $columns = '*', array $where = null, int $count = null, int $offset = null): bool|Generator {
382 376
         $res = self::select($table, $columns, $where, $count, $offset);
383 377
         if ($res) {
384
-            while ($row = $res->fetch_assoc()) yield $row;
378
+            while ($row = $res->fetch_assoc()) {
379
+                yield $row;
380
+            }
381
+        } else {
382
+            return $res;
385 383
         }
386
-        else return $res;
387 384
     }
388 385
 }
389 386
\ No newline at end of file
Please login to merge, or discard this patch.
src/database/json.php 1 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
             return false;
507 488
         }
@@ -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
             return false;
528 511
         }
@@ -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
             return false;
550 535
         }
@@ -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
             return false;
572 559
         }
Please login to merge, or discard this patch.