Passed
Push — main ( fce709...e7b3ac )
by Miaad
02:07
created
src/tools/generator.php 1 patch
Braces   +16 added lines, -17 removed lines patch added patch discarded remove patch
@@ -71,7 +71,9 @@  discard block
 block discarded – undo
71 71
                 $keyboard_object->setOne_time_keyboard($keyboard['one_time']);
72 72
             }
73 73
             foreach ($keyboard as $row) {
74
-                if (!is_array($row)) continue;
74
+                if (!is_array($row)) {
75
+                    continue;
76
+                }
75 77
                 $buttons = [];
76 78
                 foreach ($row as $base_button) {
77 79
                     $button_info = explode('||', $base_button);
@@ -80,15 +82,12 @@  discard block
 block discarded – undo
80 82
                     if (count($button_info) > 1) {
81 83
                         if ($button_info[1] === 'con') {
82 84
                             $button->setRequest_contact(true);
83
-                        }
84
-                        elseif ($button_info[1] === 'loc') {
85
+                        } elseif ($button_info[1] === 'loc') {
85 86
                             $button->setRequest_location(true);
86
-                        }
87
-                        elseif ($button_info[1] === 'poll') {
87
+                        } elseif ($button_info[1] === 'poll') {
88 88
                             $type = $button_info[2] === pollType::QUIZ ? pollType::QUIZ : pollType::REGULAR;
89 89
                             $button->setRequest_poll((new keyboardButtonPollType())->setType($type));
90
-                        }
91
-                        elseif ($button_info[1] === 'web' && isset($button_info[2])) {
90
+                        } elseif ($button_info[1] === 'web' && isset($button_info[2])) {
92 91
                             $url = $button_info[2];
93 92
                             $button->setWeb_app((new webAppInfo())->setUrl($url));
94 93
                         }
@@ -98,8 +97,7 @@  discard block
 block discarded – undo
98 97
                 $keyboard_object->setKeyboard([$buttons]);
99 98
             }
100 99
             return $keyboard_object;
101
-        }
102
-        elseif (!empty($inline)) {
100
+        } elseif (!empty($inline)) {
103 101
             $keyboard_object = new inlineKeyboardMarkup();
104 102
             foreach ($inline as $row) {
105 103
                 $buttons = [];
@@ -108,20 +106,17 @@  discard block
 block discarded – undo
108 106
                     if (isset($button_info[1])) {
109 107
                         if (filter_var($button_info[1], FILTER_VALIDATE_URL) && str_starts_with($button_info[1], 'http')) {
110 108
                             $button->setText($button_info[0])->setUrl($button_info[1]);
111
-                        }
112
-                        else {
109
+                        } else {
113 110
                             $button->setText($button_info[0])->setCallback_data($button_info[1]);
114 111
                         }
115
-                    }
116
-                    else {
112
+                    } else {
117 113
                         $button->setText($button_info[0])->setUrl('https://t.me/BPT_CH');
118 114
                     }
119 115
                 }
120 116
                 $keyboard_object->setInline_keyboard([$buttons]);
121 117
             }
122 118
             return $keyboard_object;
123
-        }
124
-        else {
119
+        } else {
125 120
             logger::write("tools::eKey function used\nkeyboard or inline parameter must be set",loggerTypes::ERROR);
126 121
             throw new bptException('ARGUMENT_NOT_FOUND_KEYBOARD_INLINE');
127 122
         }
@@ -140,8 +135,12 @@  discard block
 block discarded – undo
140 135
      * @return string
141 136
      */
142 137
     public static function inviteLink (int $user_id = null, string $bot_username = null): string {
143
-        if (empty($user_id)) $user_id = telegram::catchFields(fields::USER_ID);
144
-        if (empty($bot_username)) $bot_username = telegram::getMe()->username;
138
+        if (empty($user_id)) {
139
+            $user_id = telegram::catchFields(fields::USER_ID);
140
+        }
141
+        if (empty($bot_username)) {
142
+            $bot_username = telegram::getMe()->username;
143
+        }
145 144
         return 'https://t.me/' . str_replace('@', '', $bot_username) . '?start=ref_' . tools::shortEncode($user_id);
146 145
     }
147 146
 }
148 147
\ No newline at end of file
Please login to merge, or discard this patch.
src/receiver/webhook.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,15 +16,13 @@  discard block
 block discarded – undo
16 16
     public static function init () {
17 17
         if (settings::$multi) {
18 18
             multi::init();
19
-        }
20
-        else {
19
+        } else {
21 20
             if (lock::exist('BPT-HOOK')) {
22 21
                 receiver::telegramVerify();
23 22
                 self::checkSecret();
24 23
                 logger::write('Update received , lets process it ;)');
25 24
                 receiver::processUpdate();
26
-            }
27
-            else {
25
+            } else {
28 26
                 self::processSetWebhook();
29 27
             }
30 28
         }
@@ -46,8 +44,7 @@  discard block
 block discarded – undo
46 44
         $res = telegram::setWebhook($url, settings::$certificate, max_connections: settings::$max_connection, allowed_updates: settings::$allowed_updates, drop_pending_updates: settings::$skip_old_updates, secret_token: $secret);
47 45
         if (telegram::$status) {
48 46
             logger::write('Webhook was set successfully',loggerTypes::INFO);
49
-        }
50
-        else {
47
+        } else {
51 48
             logger::write("There is some problem happened , telegram response : \n".json_encode($res),loggerTypes::ERROR);
52 49
             BPT::exit(print_r($res,true));
53 50
         }
@@ -69,8 +66,7 @@  discard block
 block discarded – undo
69 66
             if (is_string(settings::$certificate)) {
70 67
                 if (file_exists(settings::$certificate)) {
71 68
                     settings::$certificate = new CURLFile(settings::$certificate);
72
-                }
73
-                else {
69
+                } else {
74 70
                     settings::$certificate = null;
75 71
                 }
76 72
             }
Please login to merge, or discard this patch.
src/receiver/receiver.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@  discard block
 block discarded – undo
27 27
                 if (isset($_SERVER['HTTP_CF_CONNECTING_IP']) && tools::isCloudFlare($ip)) {
28 28
                     $ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
29 29
                 }
30
-            }
31
-            elseif (settings::$arvancloud_verify) {
30
+            } elseif (settings::$arvancloud_verify) {
32 31
                 if (isset($_SERVER['HTTP_AR_REAL_IP']) && tools::isArvanCloud($ip)) {
33 32
                     $ip = $_SERVER['HTTP_AR_REAL_IP'];
34 33
                 }
@@ -87,46 +86,37 @@  discard block
 block discarded – undo
87 86
                 if (self::handlerExist('message')) {
88 87
                     BPT::$handler->message(BPT::$update->message);
89 88
                 }
90
-            }
91
-            elseif (isset(BPT::$update->edited_message)) {
89
+            } elseif (isset(BPT::$update->edited_message)) {
92 90
                 if (self::handlerExist('edited_message')) {
93 91
                     BPT::$handler->edited_message(BPT::$update->edited_message);
94 92
                 }
95
-            }
96
-            elseif (isset(BPT::$update->channel_post)) {
93
+            } elseif (isset(BPT::$update->channel_post)) {
97 94
                 if (self::handlerExist('channel_post')) {
98 95
                     BPT::$handler->channel_post(BPT::$update->channel_post);
99 96
                 }
100
-            }
101
-            elseif (isset(BPT::$update->edited_channel_post)) {
97
+            } elseif (isset(BPT::$update->edited_channel_post)) {
102 98
                 if (self::handlerExist('edited_channel_post')) {
103 99
                     BPT::$handler->edited_channel_post(BPT::$update->edited_channel_post);
104 100
                 }
105
-            }
106
-            elseif (isset(BPT::$update->inline_query)) {
101
+            } elseif (isset(BPT::$update->inline_query)) {
107 102
                 if (self::handlerExist('inline_query')) {
108 103
                     BPT::$handler->inline_query(BPT::$update->inline_query);
109 104
                 }
110
-            }
111
-            elseif (isset(BPT::$update->callback_query)) {
105
+            } elseif (isset(BPT::$update->callback_query)) {
112 106
                 if (self::handlerExist('callback_query')) {
113 107
                     BPT::$handler->callback_query(BPT::$update->callback_query);
114 108
                 }
115
-            }
116
-            elseif (isset(BPT::$update->my_chat_member)) {
109
+            } elseif (isset(BPT::$update->my_chat_member)) {
117 110
                 if (self::handlerExist('my_chat_member')) {
118 111
                     BPT::$handler->my_chat_member(BPT::$update->my_chat_member);
119 112
                 }
120
-            }
121
-            elseif (isset(BPT::$update->chat_member)) {
113
+            } elseif (isset(BPT::$update->chat_member)) {
122 114
                 if (self::handlerExist('chat_member')) {
123 115
                     BPT::$handler->chat_member(BPT::$update->chat_member);
124 116
                 }
125
-            }
126
-            elseif (self::handlerExist('something_else')) {
117
+            } elseif (self::handlerExist('something_else')) {
127 118
                 BPT::$handler->something_else(BPT::$update);
128
-            }
129
-            else {
119
+            } else {
130 120
                 logger::write('Update received but handlers does not set',loggerTypes::WARNING);
131 121
             }
132 122
         }
Please login to merge, or discard this patch.