@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | protected static function telegramVerify(string $ip = null) { |
23 | 23 | if (settings::$telegram_verify) { |
24 | 24 | if (!tools::isTelegram($ip ?? $_SERVER['REMOTE_ADDR'] ?? '')) { |
25 | - logger::write('not authorized access denied. IP : '. $ip ?? $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::ERROR); |
|
25 | + logger::write('not authorized access denied. IP : '.$ip ?? $_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::ERROR); |
|
26 | 26 | BPT::exit(); |
27 | 27 | } |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | - protected static function processUpdate(string|stdClass $update = null) { |
|
31 | + protected static function processUpdate(string | stdClass $update = null) { |
|
32 | 32 | if (!is_object($update)) { |
33 | 33 | $update = json_decode($update ?? file_get_contents("php://input")); |
34 | 34 | if (!$update) { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | self::processHandler(); |
42 | 42 | } |
43 | 43 | |
44 | - protected static function setMessageExtra (update &$update) { |
|
44 | + protected static function setMessageExtra(update & $update) { |
|
45 | 45 | if ((isset($update->message) && isset($update->message->text)) || (isset($update->edited_message) && isset($update->edited_message->text))) { |
46 | 46 | $type = isset($update->message) ? 'message' : 'edited_message'; |
47 | 47 | $text = &$update->$type->text; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | BPT::$handler->something_else(BPT::$update); |
84 | 84 | } |
85 | 85 | else { |
86 | - logger::write('Update received but handlers does not set',loggerTypes::WARNING); |
|
86 | + logger::write('Update received but handlers does not set', loggerTypes::WARNING); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
@@ -63,26 +63,21 @@ |
||
63 | 63 | if (self::handlerExist('message')) { |
64 | 64 | BPT::$handler->message(BPT::$update->message); |
65 | 65 | } |
66 | - } |
|
67 | - elseif (isset(BPT::$update->callback_query)) { |
|
66 | + } elseif (isset(BPT::$update->callback_query)) { |
|
68 | 67 | if (self::handlerExist('callback_query')) { |
69 | 68 | BPT::$handler->callback_query(BPT::$update->callback_query); |
70 | 69 | } |
71 | - } |
|
72 | - elseif (isset(BPT::$update->inline_query)) { |
|
70 | + } elseif (isset(BPT::$update->inline_query)) { |
|
73 | 71 | if (self::handlerExist('inline_query')) { |
74 | 72 | BPT::$handler->inline_query(BPT::$update->inline_query); |
75 | 73 | } |
76 | - } |
|
77 | - elseif (isset(BPT::$update->edited_message)) { |
|
74 | + } elseif (isset(BPT::$update->edited_message)) { |
|
78 | 75 | if (self::handlerExist('edited_message')) { |
79 | 76 | BPT::$handler->edited_message(BPT::$update->edited_message); |
80 | 77 | } |
81 | - } |
|
82 | - elseif (self::handlerExist('something_else')) { |
|
78 | + } elseif (self::handlerExist('something_else')) { |
|
83 | 79 | BPT::$handler->something_else(BPT::$update); |
84 | - } |
|
85 | - else { |
|
80 | + } else { |
|
86 | 81 | logger::write('Update received but handlers does not set',loggerTypes::WARNING); |
87 | 82 | } |
88 | 83 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @param string $username Your text to be check is username or not e.g. : 'BPT_CH' | '@BPT_CH' |
23 | 23 | * @return bool |
24 | 24 | */ |
25 | - public static function isUsername (string $username): bool { |
|
25 | + public static function isUsername(string $username): bool { |
|
26 | 26 | $length = strlen($username); |
27 | 27 | return strpos($username, '__') === false && $length >= 5 && $length <= 33 && preg_match('/^@?([a-zA-Z])(\w{4,31})$/', $username); |
28 | 28 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param string $range Your range ip for check , if you didn't specify the block , it will be 32 |
39 | 39 | * @return bool |
40 | 40 | */ |
41 | - public static function ipInRange (string $ip, string $range): bool { |
|
41 | + public static function ipInRange(string $ip, string $range): bool { |
|
42 | 42 | if (!str_contains($range, '/')) { |
43 | 43 | $range .= '/32'; |
44 | 44 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param string $ip Your ip to be check is telegram or not e.g. '192.168.1.1' |
58 | 58 | * @return bool |
59 | 59 | */ |
60 | - public static function isTelegram (string $ip): bool { |
|
60 | + public static function isTelegram(string $ip): bool { |
|
61 | 61 | return self::ipInRange($ip, '149.154.160.0/20') || self::ipInRange($ip, '91.108.4.0/22'); |
62 | 62 | } |
63 | 63 | |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | * @param string $ip Your ip to be check is CloudFlare or not e.g. '192.168.1.1' |
72 | 72 | * @return bool |
73 | 73 | */ |
74 | - public static function isCloudFlare (string $ip): bool { |
|
74 | + public static function isCloudFlare(string $ip): bool { |
|
75 | 75 | $cf_ips = ['173.245.48.0/20', '103.21.244.0/22', '103.22.200.0/22', '103.31.4.0/22', '141.101.64.0/18', '108.162.192.0/18', '190.93.240.0/20', '188.114.96.0/20', '197.234.240.0/22', '198.41.128.0/17', '162.158.0.0/15', '104.16.0.0/12', '172.64.0.0/13', '131.0.72.0/22']; |
76 | 76 | foreach ($cf_ips as $cf_ip) { |
77 | - if (self::ipInRange($ip,$cf_ip)) { |
|
77 | + if (self::ipInRange($ip, $cf_ip)) { |
|
78 | 78 | return true; |
79 | 79 | } |
80 | 80 | } |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @param bool $verify check token with telegram or not |
96 | 96 | * @return bool|array return array when verify is active and token is true array of telegram getMe result |
97 | 97 | */ |
98 | - public static function isToken (string $token, bool $verify = false): bool|array { |
|
98 | + public static function isToken(string $token, bool $verify = false): bool | array { |
|
99 | 99 | if (preg_match('/^(\d{8,10}):[\w\-]{35}$/', $token)) { |
100 | - if ($verify){ |
|
100 | + if ($verify) { |
|
101 | 101 | $res = telegram::me($token); |
102 | 102 | if ($res['ok']) { |
103 | 103 | return $res['result']; |
@@ -130,14 +130,14 @@ discard block |
||
130 | 130 | * @param int|null $user_id e.g. => '442109602' |
131 | 131 | * @return bool |
132 | 132 | */ |
133 | - public static function isJoined (array|string|int $ids , int|null $user_id = null): bool { |
|
133 | + public static function isJoined(array | string | int $ids, int | null $user_id = null): bool { |
|
134 | 134 | if (!is_array($ids)) { |
135 | 135 | $ids = [$ids]; |
136 | 136 | } |
137 | 137 | //$user_id = $user_id ?? $this->catchFields(['field' => 'user_id']); |
138 | 138 | |
139 | 139 | foreach ($ids as $id) { |
140 | - $check = telegram::getChatMember($id,$user_id); |
|
140 | + $check = telegram::getChatMember($id, $user_id); |
|
141 | 141 | if (isset($check['result'])) { |
142 | 142 | $check = $check['result']['status']; |
143 | 143 | return !($check === chatMemberStatus::LEFT || $check === chatMemberStatus::KICKED); |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | * @param string $characters e.g. => 'abcdefg' |
166 | 166 | * @return string |
167 | 167 | */ |
168 | - public static function randomString (int $length = 16, string $characters = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'): string { |
|
168 | + public static function randomString(int $length = 16, string $characters = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'): string { |
|
169 | 169 | $rand_string = ''; |
170 | 170 | $char_len = strlen($characters) - 1; |
171 | - for ($i = 0; $i < $length; $i ++) { |
|
171 | + for ($i = 0; $i < $length; $i++) { |
|
172 | 172 | $rand_string .= $characters[rand(0, $char_len)]; |
173 | 173 | } |
174 | 174 | return $rand_string; |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | * @param string $mode Your selected mode e.g. => `parseMode::HTML` | `HTML` |
188 | 188 | * @return string|false return false when mode is incorrect |
189 | 189 | */ |
190 | - public static function modeEscape (string $text, string $mode = parseMode::HTML): string|false { |
|
190 | + public static function modeEscape(string $text, string $mode = parseMode::HTML): string | false { |
|
191 | 191 | return match ($mode) { |
192 | - parseMode::HTML => str_replace(['&', '<', '>',], ["&", "<", ">",], $text), |
|
193 | - parseMode::MARKDOWN => str_replace(['\\', '_', '*', '`', '['], ['\\\\', '\_', '\*', '\`', '\[',], $text), |
|
192 | + parseMode::HTML => str_replace(['&', '<', '>', ], ["&", "<", ">", ], $text), |
|
193 | + parseMode::MARKDOWN => str_replace(['\\', '_', '*', '`', '['], ['\\\\', '\_', '\*', '\`', '\[', ], $text), |
|
194 | 194 | parseMode::MARKDOWNV2 => str_replace( |
195 | 195 | ['_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!', '\\'], |
196 | 196 | ['\_', '\*', '\[', '\]', '\(', '\)', '\~', '\`', '\>', '\#', '\+', '\-', '\=', '\|', '\{', '\}', '\.', '\!', '\\\\'], |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | * @param int $precision e.g. => 2 |
217 | 217 | * @return string |
218 | 218 | */ |
219 | - public static function byteFormat (int $byte, int $precision = 2): string { |
|
219 | + public static function byteFormat(int $byte, int $precision = 2): string { |
|
220 | 220 | $rate_counter = 0; |
221 | 221 | |
222 | - while ($byte > 1024){ |
|
222 | + while ($byte > 1024) { |
|
223 | 223 | $byte /= 1024; |
224 | 224 | $rate_counter++; |
225 | 225 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $byte = round($byte, $precision); |
229 | 229 | } |
230 | 230 | |
231 | - return $byte . ' ' . ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'][$rate_counter]; |
|
231 | + return $byte.' '.['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'][$rate_counter]; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @param bool $format if you set this true , you will receive symbolic string like 2.76MB |
249 | 249 | * @return string|int|false string for formatted data , int for normal data , false when size can not be found(file not found or ...) |
250 | 250 | */ |
251 | - public static function size (string $path, bool $format = true): string|int|false { |
|
251 | + public static function size(string $path, bool $format = true): string | int | false { |
|
252 | 252 | if (filter_var($path, FILTER_VALIDATE_URL)) { |
253 | 253 | $ch = curl_init($path); |
254 | 254 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * @param array $array e.g. => ['path'=>'xfolder/yfolder','sub'=>true] |
284 | 284 | * @return bool |
285 | 285 | */ |
286 | - public static function delete (string $path, bool $sub = true): bool { |
|
286 | + public static function delete(string $path, bool $sub = true): bool { |
|
287 | 287 | if (is_dir($path)) { |
288 | 288 | if (count(scandir($path)) > 2) { |
289 | 289 | if ($sub) { |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | rmdir($path); |
296 | 296 | } |
297 | 297 | else { |
298 | - logger::write("BPT delete function used\ndelete function cannot delete folder because its have subFiles and sub parameter haven't true value",loggerTypes::ERROR); |
|
298 | + logger::write("BPT delete function used\ndelete function cannot delete folder because its have subFiles and sub parameter haven't true value", loggerTypes::ERROR); |
|
299 | 299 | return false; |
300 | 300 | } |
301 | 301 | } |
@@ -318,9 +318,9 @@ discard block |
||
318 | 318 | * @return array |
319 | 319 | * @throws Exception |
320 | 320 | */ |
321 | - public static function time2string (int $datetime): array { |
|
321 | + public static function time2string(int $datetime): array { |
|
322 | 322 | $now = new DateTime; |
323 | - $input = new DateTime('@' . $datetime); |
|
323 | + $input = new DateTime('@'.$datetime); |
|
324 | 324 | $status = $now < $input ? 'later' : 'ago'; |
325 | 325 | $diff = $now->diff($input); |
326 | 326 | $diff->w = floor($diff->d / 7); |
@@ -257,15 +257,15 @@ discard block |
||
257 | 257 | curl_exec($ch); |
258 | 258 | $size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD); |
259 | 259 | curl_close($ch); |
260 | - } |
|
261 | - else { |
|
260 | + } else { |
|
262 | 261 | $size = file_exists($path) ? filesize($path) : false; |
263 | 262 | } |
264 | 263 | |
265 | 264 | if (isset($size) && is_numeric($size)) { |
266 | 265 | return $format ? tools::byteFormat($size) : $size; |
267 | - } |
|
268 | - else return false; |
|
266 | + } else { |
|
267 | + return false; |
|
268 | + } |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | //fix methods after here comments |
@@ -293,15 +293,16 @@ discard block |
||
293 | 293 | $file->isDir() ? rmdir($file->getRealPath()) : unlink($file->getRealPath()); |
294 | 294 | } |
295 | 295 | rmdir($path); |
296 | - } |
|
297 | - else { |
|
296 | + } else { |
|
298 | 297 | logger::write("BPT delete function used\ndelete function cannot delete folder because its have subFiles and sub parameter haven't true value",loggerTypes::ERROR); |
299 | 298 | return false; |
300 | 299 | } |
301 | - } |
|
302 | - else rmdir($path); |
|
303 | - } |
|
304 | - else unlink($path); |
|
300 | + } else { |
|
301 | + rmdir($path); |
|
302 | + } |
|
303 | + } else { |
|
304 | + unlink($path); |
|
305 | + } |
|
305 | 306 | |
306 | 307 | return true; |
307 | 308 | } |
@@ -328,8 +329,9 @@ discard block |
||
328 | 329 | foreach ($string as $k => &$v) { |
329 | 330 | if ($diff->$v) { |
330 | 331 | $v = $diff->$v; |
331 | - } |
|
332 | - else unset($string[$k]); |
|
332 | + } else { |
|
333 | + unset($string[$k]); |
|
334 | + } |
|
333 | 335 | } |
334 | 336 | $string['status'] = $status; |
335 | 337 | return count($string) > 1 ? $string : ['status' => 'now']; |
@@ -11,33 +11,33 @@ discard block |
||
11 | 11 | class answer { |
12 | 12 | private static bool $is_answered = false; |
13 | 13 | |
14 | - public static function init(string $method,array $data) { |
|
14 | + public static function init(string $method, array $data) { |
|
15 | 15 | self::checkAnswered(); |
16 | 16 | self::checkWebhook(); |
17 | 17 | self::deleteAdditionalData($data); |
18 | 18 | self::$is_answered = true; |
19 | 19 | $data['method'] = $method; |
20 | 20 | $payload = json_encode($data); |
21 | - header('Content-Type: application/json;Content-Length: ' . strlen($payload)); |
|
21 | + header('Content-Type: application/json;Content-Length: '.strlen($payload)); |
|
22 | 22 | echo $payload; |
23 | 23 | return true; |
24 | 24 | } |
25 | 25 | |
26 | 26 | private static function checkAnswered() { |
27 | 27 | if (self::$is_answered) { |
28 | - logger::write('You can use answer mode only once for each webhook update , You already did it!',loggerTypes::ERROR); |
|
28 | + logger::write('You can use answer mode only once for each webhook update , You already did it!', loggerTypes::ERROR); |
|
29 | 29 | BPT::exit(); |
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | private static function checkWebhook() { |
34 | - if(settings::$receiver === receiver::GETUPDATES) { |
|
35 | - logger::write('Answer mode only work when receiver is webhook',loggerTypes::ERROR); |
|
34 | + if (settings::$receiver === receiver::GETUPDATES) { |
|
35 | + logger::write('Answer mode only work when receiver is webhook', loggerTypes::ERROR); |
|
36 | 36 | BPT::exit(); |
37 | 37 | } |
38 | 38 | |
39 | - if(settings::$multi) { |
|
40 | - logger::write('You can not use answer mode when multi setting is on',loggerTypes::ERROR); |
|
39 | + if (settings::$multi) { |
|
40 | + logger::write('You can not use answer mode when multi setting is on', loggerTypes::ERROR); |
|
41 | 41 | BPT::exit(); |
42 | 42 | } |
43 | 43 | } |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | if (isset($data['return_array'])) { |
53 | 53 | unset($data['return_array']); |
54 | 54 | } |
55 | - foreach ($data as $key=>&$value){ |
|
56 | - if (!isset($value)){ |
|
55 | + foreach ($data as $key=>&$value) { |
|
56 | + if (!isset($value)) { |
|
57 | 57 | unset($data[$key]); |
58 | 58 | continue; |
59 | 59 | } |
60 | - if (is_array($value) || (is_object($value) && !is_a($value,'CURLFile'))){ |
|
60 | + if (is_array($value) || (is_object($value) && !is_a($value, 'CURLFile'))) { |
|
61 | 61 | $value = json_encode($value); |
62 | 62 | } |
63 | 63 | } |
@@ -10,18 +10,18 @@ discard block |
||
10 | 10 | class curl { |
11 | 11 | private static CurlHandle $curl_handler; |
12 | 12 | |
13 | - public static function init(string $method,array $data) { |
|
13 | + public static function init(string $method, array $data) { |
|
14 | 14 | $info = self::getInfo($data); |
15 | 15 | $data = $info['data']; |
16 | 16 | $token = $info['token']; |
17 | 17 | $handler = $info['handler']; |
18 | - self::setTimeout($data,$handler,$method); |
|
18 | + self::setTimeout($data, $handler, $method); |
|
19 | 19 | self::setData($data); |
20 | 20 | $data['method'] = $method; |
21 | 21 | curl_setopt($handler, CURLOPT_POSTFIELDS, $data); |
22 | 22 | $result = curl_exec($handler); |
23 | 23 | if (curl_errno($handler)) { |
24 | - logger::write(curl_error($handler),loggerTypes::WARNING); |
|
24 | + logger::write(curl_error($handler), loggerTypes::WARNING); |
|
25 | 25 | } |
26 | 26 | if ($token != settings::$token) { |
27 | 27 | curl_close($handler); |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true); |
38 | 38 | curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
39 | 39 | } |
40 | - else{ |
|
40 | + else { |
|
41 | 41 | $token = settings::$token; |
42 | - if (!isset(self::$curl_handler)){ |
|
42 | + if (!isset(self::$curl_handler)) { |
|
43 | 43 | self::$curl_handler = curl_init(settings::$base_url."$token/"); |
44 | 44 | curl_setopt(self::$curl_handler, CURLOPT_RETURNTRANSFER, true); |
45 | 45 | curl_setopt(self::$curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
@@ -55,22 +55,22 @@ discard block |
||
55 | 55 | ]; |
56 | 56 | } |
57 | 57 | |
58 | - private static function setTimeout(array &$data , CurlHandle $curl_handler,string $method) { |
|
58 | + private static function setTimeout(array &$data, CurlHandle $curl_handler, string $method) { |
|
59 | 59 | if (isset($data['forgot'])) { |
60 | 60 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time); |
61 | 61 | unset($data['forgot']); |
62 | 62 | } |
63 | - elseif ($method === 'getUpdates'){ |
|
63 | + elseif ($method === 'getUpdates') { |
|
64 | 64 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000); |
65 | 65 | } |
66 | - else{ |
|
66 | + else { |
|
67 | 67 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 300); |
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | 71 | private static function setData(array &$data) { |
72 | - foreach ($data as &$value){ |
|
73 | - if (is_array($value) || (is_object($value) && !is_a($value,'CURLFile'))){ |
|
72 | + foreach ($data as &$value) { |
|
73 | + if (is_array($value) || (is_object($value) && !is_a($value, 'CURLFile'))) { |
|
74 | 74 | $value = json_encode($value); |
75 | 75 | } |
76 | 76 | } |
@@ -36,8 +36,7 @@ discard block |
||
36 | 36 | $curl_handler = curl_init(settings::$base_url."$token/"); |
37 | 37 | curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true); |
38 | 38 | curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
39 | - } |
|
40 | - else{ |
|
39 | + } else{ |
|
41 | 40 | $token = settings::$token; |
42 | 41 | if (!isset(self::$curl_handler)){ |
43 | 42 | self::$curl_handler = curl_init(settings::$base_url."$token/"); |
@@ -59,11 +58,9 @@ discard block |
||
59 | 58 | if (isset($data['forgot'])) { |
60 | 59 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time); |
61 | 60 | unset($data['forgot']); |
62 | - } |
|
63 | - elseif ($method === 'getUpdates'){ |
|
61 | + } elseif ($method === 'getUpdates'){ |
|
64 | 62 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000); |
65 | - } |
|
66 | - else{ |
|
63 | + } else{ |
|
67 | 64 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 300); |
68 | 65 | } |
69 | 66 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @method static getGameHigh (int|null|array $user_id = null, int|null $chat_id = null, int|null $message_id = null, string|null $inline_message_id = null, string|null $token = null, bool|null $return_array = null, bool|null $forgot = null, bool|null $answer = null) Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects. |
217 | 217 | */ |
218 | 218 | class telegram { |
219 | - public function __call (string $name, array $arguments) { |
|
219 | + public function __call(string $name, array $arguments) { |
|
220 | 220 | if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) { |
221 | 221 | return request::$name(...$arguments[0]); |
222 | 222 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | - public static function __callStatic (string $name, array $arguments) { |
|
228 | + public static function __callStatic(string $name, array $arguments) { |
|
229 | 229 | if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) { |
230 | 230 | return request::$name(...$arguments[0]); |
231 | 231 | } |
@@ -219,8 +219,7 @@ discard block |
||
219 | 219 | public function __call (string $name, array $arguments) { |
220 | 220 | if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) { |
221 | 221 | return request::$name(...$arguments[0]); |
222 | - } |
|
223 | - else { |
|
222 | + } else { |
|
224 | 223 | return request::$name(...$arguments); |
225 | 224 | } |
226 | 225 | } |
@@ -228,8 +227,7 @@ discard block |
||
228 | 227 | public static function __callStatic (string $name, array $arguments) { |
229 | 228 | if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) { |
230 | 229 | return request::$name(...$arguments[0]); |
231 | - } |
|
232 | - else { |
|
230 | + } else { |
|
233 | 231 | return request::$name(...$arguments); |
234 | 232 | } |
235 | 233 | } |
@@ -212,94 +212,94 @@ discard block |
||
212 | 212 | ]; |
213 | 213 | |
214 | 214 | private const METHODS_KEYS = [ |
215 | - 'getUpdates' => ['offset','limit','timeout','allowed_updates','token','return_array','forgot','answer'], |
|
216 | - 'setWebhook' => ['url','certificate','ip_address','max_connections','allowed_updates','drop_pending_updates','secret_token','token','return_array','forgot','answer'], |
|
217 | - 'deleteWebhook' => ['drop_pending_updates','token','return_array','forgot','answer'], |
|
218 | - 'getWebhookInfo' => ['token','return_array','forgot','answer'], |
|
219 | - 'getMe' => ['token','return_array','forgot','answer'], |
|
220 | - 'logOut' => ['token','return_array','forgot','answer'], |
|
221 | - 'close' => ['token','return_array','forgot','answer'], |
|
222 | - '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'], |
|
223 | - 'forwardMessage' => ['chat_id','from_chat_id','disable_notification','protect_content','message_id','token','return_array','forgot','answer'], |
|
224 | - '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'], |
|
225 | - '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'], |
|
226 | - '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'], |
|
227 | - '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'], |
|
228 | - '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'], |
|
229 | - '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'], |
|
230 | - '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'], |
|
231 | - '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'], |
|
232 | - 'sendMediaGroup' => ['media','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','token','return_array','forgot','answer'], |
|
233 | - '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'], |
|
234 | - 'editMessageLiveLocation' => ['latitude','longitude','chat_id','message_id','inline_message_id','horizontal_accuracy','heading','proximity_alert_radius','reply_markup','token','return_array','forgot','answer'], |
|
235 | - 'stopMessageLiveLocation' => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
236 | - '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'], |
|
237 | - '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'], |
|
238 | - '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'], |
|
239 | - 'sendDice' => ['chat_id','emoji','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
240 | - 'sendChatAction' => ['chat_id','action','token','return_array','forgot','answer'], |
|
241 | - 'getUserProfilePhotos' => ['user_id','offset','limit','token','return_array','forgot','answer'], |
|
242 | - 'getFile' => ['file_id','token','return_array','forgot','answer'], |
|
243 | - 'banChatMember' => ['chat_id','user_id','until_date','revoke_messages','token','return_array','forgot','answer'], |
|
244 | - 'unbanChatMember' => ['chat_id','user_id','only_if_banned','token','return_array','forgot','answer'], |
|
245 | - 'restrictChatMember' => ['permissions','chat_id','user_id','until_date','token','return_array','forgot','answer'], |
|
246 | - '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'], |
|
247 | - 'setChatAdministratorCustomTitle' => ['custom_title','chat_id','user_id','token','return_array','forgot','answer'], |
|
248 | - 'banChatSenderChat' => ['sender_chat_id','chat_id','token','return_array','forgot','answer'], |
|
249 | - 'unbanChatSenderChat' => ['sender_chat_id','chat_id','token','return_array','forgot','answer'], |
|
250 | - 'setChatPermissions' => ['permissions','chat_id','token','return_array','forgot','answer'], |
|
251 | - 'exportChatInviteLink' => ['chat_id','token','return_array','forgot','answer'], |
|
252 | - 'createChatInviteLink' => ['chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'], |
|
253 | - 'editChatInviteLink' => ['invite_link','chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'], |
|
254 | - 'revokeChatInviteLink' => ['invite_link','chat_id','token','return_array','forgot','answer'], |
|
255 | - 'approveChatJoinRequest' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
256 | - 'declineChatJoinRequest' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
257 | - 'setChatPhoto' => ['photo','chat_id','token','return_array','forgot','answer'], |
|
258 | - 'deleteChatPhoto' => ['chat_id','token','return_array','forgot','answer'], |
|
259 | - 'setChatTitle' => ['title','chat_id','token','return_array','forgot','answer'], |
|
260 | - 'setChatDescription' => ['chat_id','description','token','return_array','forgot','answer'], |
|
261 | - 'pinChatMessage' => ['message_id','chat_id','disable_notification','token','return_array','forgot','answer'], |
|
262 | - 'unpinChatMessage' => ['chat_id','message_id','token','return_array','forgot','answer'], |
|
263 | - 'unpinAllChatMessages' => ['chat_id','token','return_array','forgot','answer'], |
|
264 | - 'leaveChat' => ['chat_id','token','return_array','forgot','answer'], |
|
265 | - 'getChat' => ['chat_id','token','return_array','forgot','answer'], |
|
266 | - 'getChatAdministrators' => ['chat_id','token','return_array','forgot','answer'], |
|
267 | - 'getChatMemberCount' => ['chat_id','token','return_array','forgot','answer'], |
|
268 | - 'getChatMember' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
269 | - 'setChatStickerSet' => ['sticker_set_name','chat_id','token','return_array','forgot','answer'], |
|
270 | - 'deleteChatStickerSet' => ['chat_id','token','return_array','forgot','answer'], |
|
271 | - 'answerCallbackQuery' => ['callback_query_id','text','show_alert','url','cache_time','token','return_array','forgot','answer'], |
|
272 | - 'setMyCommands' => ['commands','scope','language_code','token','return_array','forgot','answer'], |
|
273 | - 'deleteMyCommands' => ['scope','language_code','token','return_array','forgot','answer'], |
|
274 | - 'getMyCommands' => ['scope','language_code','token','return_array','forgot','answer'], |
|
275 | - 'setChatMenuButton' => ['chat_id','menu_button','token','return_array','forgot','answer'], |
|
276 | - 'getChatMenuButton' => ['chat_id','token','return_array','forgot','answer'], |
|
277 | - 'setMyDefaultAdministratorRights' => ['rights','for_channels','token','return_array','forgot','answer'], |
|
278 | - 'getMyDefaultAdministratorRights' => ['for_channels','token','return_array','forgot','answer'], |
|
279 | - 'editMessageText' => ['text','chat_id','message_id','inline_message_id','parse_mode','entities','disable_web_page_preview','reply_markup','token','return_array','forgot','answer'], |
|
280 | - 'editMessageCaption' => ['chat_id','message_id','inline_message_id','caption','parse_mode','caption_entities','reply_markup','token','return_array','forgot','answer'], |
|
281 | - 'editMessageMedia' => ['media','chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
282 | - 'editMessageReplyMarkup' => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
283 | - 'stopPoll' => ['chat_id','message_id','reply_markup','token','return_array','forgot','answer'], |
|
284 | - 'deleteMessage' => ['chat_id','message_id','token','return_array','forgot','answer'], |
|
285 | - 'sendSticker' => ['sticker','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
286 | - 'getStickerSet' => ['name','token','return_array','forgot','answer'], |
|
287 | - 'uploadStickerFile' => ['png_sticker','user_id','token','return_array','forgot','answer'], |
|
288 | - 'createNewStickerSet' => ['name','title','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','contains_masks','mask_position','token','return_array','forgot','answer'], |
|
289 | - 'addStickerToSet' => ['name','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','mask_position','token','return_array','forgot','answer'], |
|
290 | - 'setStickerPositionInSet' => ['sticker','position','token','return_array','forgot','answer'], |
|
291 | - 'deleteStickerFromSet' => ['sticker','token','return_array','forgot','answer'], |
|
292 | - 'setStickerSetThumb' => ['name','user_id','thumb','token','return_array','forgot','answer'], |
|
293 | - 'answerInlineQuery' => ['results','inline_query_id','cache_time','is_personal','next_offset','switch_pm_text','switch_pm_parameter','token','return_array','forgot','answer'], |
|
294 | - 'answerWebAppQuery' => ['web_app_query_id','result','token','return_array','forgot','answer'], |
|
295 | - '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'], |
|
296 | - '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'], |
|
297 | - 'answerShippingQuery' => ['ok','shipping_query_id','shipping_options','error_message','token','return_array','forgot','answer'], |
|
298 | - 'answerPreCheckoutQuery' => ['ok','pre_checkout_query_id','error_message','token','return_array','forgot','answer'], |
|
299 | - 'setPassportDataErrors' => ['errors','user_id','token','return_array','forgot','answer'], |
|
300 | - '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'], |
|
301 | - 'setGameScore' => ['score','user_id','force','disable_edit_message','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'], |
|
302 | - 'getGameHighScores' => ['user_id','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'], |
|
215 | + 'getUpdates' => ['offset', 'limit', 'timeout', 'allowed_updates', 'token', 'return_array', 'forgot', 'answer'], |
|
216 | + 'setWebhook' => ['url', 'certificate', 'ip_address', 'max_connections', 'allowed_updates', 'drop_pending_updates', 'secret_token', 'token', 'return_array', 'forgot', 'answer'], |
|
217 | + 'deleteWebhook' => ['drop_pending_updates', 'token', 'return_array', 'forgot', 'answer'], |
|
218 | + 'getWebhookInfo' => ['token', 'return_array', 'forgot', 'answer'], |
|
219 | + 'getMe' => ['token', 'return_array', 'forgot', 'answer'], |
|
220 | + 'logOut' => ['token', 'return_array', 'forgot', 'answer'], |
|
221 | + 'close' => ['token', 'return_array', 'forgot', 'answer'], |
|
222 | + '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'], |
|
223 | + 'forwardMessage' => ['chat_id', 'from_chat_id', 'disable_notification', 'protect_content', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
224 | + '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'], |
|
225 | + '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'], |
|
226 | + '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'], |
|
227 | + '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'], |
|
228 | + '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'], |
|
229 | + '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'], |
|
230 | + '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'], |
|
231 | + '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'], |
|
232 | + 'sendMediaGroup' => ['media', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'token', 'return_array', 'forgot', 'answer'], |
|
233 | + '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'], |
|
234 | + 'editMessageLiveLocation' => ['latitude', 'longitude', 'chat_id', 'message_id', 'inline_message_id', 'horizontal_accuracy', 'heading', 'proximity_alert_radius', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
235 | + 'stopMessageLiveLocation' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
236 | + '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'], |
|
237 | + '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'], |
|
238 | + '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'], |
|
239 | + 'sendDice' => ['chat_id', 'emoji', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
240 | + 'sendChatAction' => ['chat_id', 'action', 'token', 'return_array', 'forgot', 'answer'], |
|
241 | + 'getUserProfilePhotos' => ['user_id', 'offset', 'limit', 'token', 'return_array', 'forgot', 'answer'], |
|
242 | + 'getFile' => ['file_id', 'token', 'return_array', 'forgot', 'answer'], |
|
243 | + 'banChatMember' => ['chat_id', 'user_id', 'until_date', 'revoke_messages', 'token', 'return_array', 'forgot', 'answer'], |
|
244 | + 'unbanChatMember' => ['chat_id', 'user_id', 'only_if_banned', 'token', 'return_array', 'forgot', 'answer'], |
|
245 | + 'restrictChatMember' => ['permissions', 'chat_id', 'user_id', 'until_date', 'token', 'return_array', 'forgot', 'answer'], |
|
246 | + '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'], |
|
247 | + 'setChatAdministratorCustomTitle' => ['custom_title', 'chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
248 | + 'banChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
249 | + 'unbanChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
250 | + 'setChatPermissions' => ['permissions', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
251 | + 'exportChatInviteLink' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
252 | + 'createChatInviteLink' => ['chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'], |
|
253 | + 'editChatInviteLink' => ['invite_link', 'chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'], |
|
254 | + 'revokeChatInviteLink' => ['invite_link', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
255 | + 'approveChatJoinRequest' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
256 | + 'declineChatJoinRequest' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
257 | + 'setChatPhoto' => ['photo', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
258 | + 'deleteChatPhoto' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
259 | + 'setChatTitle' => ['title', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
260 | + 'setChatDescription' => ['chat_id', 'description', 'token', 'return_array', 'forgot', 'answer'], |
|
261 | + 'pinChatMessage' => ['message_id', 'chat_id', 'disable_notification', 'token', 'return_array', 'forgot', 'answer'], |
|
262 | + 'unpinChatMessage' => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
263 | + 'unpinAllChatMessages' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
264 | + 'leaveChat' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
265 | + 'getChat' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
266 | + 'getChatAdministrators' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
267 | + 'getChatMemberCount' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
268 | + 'getChatMember' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
269 | + 'setChatStickerSet' => ['sticker_set_name', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
270 | + 'deleteChatStickerSet' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
271 | + 'answerCallbackQuery' => ['callback_query_id', 'text', 'show_alert', 'url', 'cache_time', 'token', 'return_array', 'forgot', 'answer'], |
|
272 | + 'setMyCommands' => ['commands', 'scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
273 | + 'deleteMyCommands' => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
274 | + 'getMyCommands' => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
275 | + 'setChatMenuButton' => ['chat_id', 'menu_button', 'token', 'return_array', 'forgot', 'answer'], |
|
276 | + 'getChatMenuButton' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
277 | + 'setMyDefaultAdministratorRights' => ['rights', 'for_channels', 'token', 'return_array', 'forgot', 'answer'], |
|
278 | + 'getMyDefaultAdministratorRights' => ['for_channels', 'token', 'return_array', 'forgot', 'answer'], |
|
279 | + 'editMessageText' => ['text', 'chat_id', 'message_id', 'inline_message_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
280 | + 'editMessageCaption' => ['chat_id', 'message_id', 'inline_message_id', 'caption', 'parse_mode', 'caption_entities', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
281 | + 'editMessageMedia' => ['media', 'chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
282 | + 'editMessageReplyMarkup' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
283 | + 'stopPoll' => ['chat_id', 'message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
284 | + 'deleteMessage' => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
285 | + 'sendSticker' => ['sticker', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
286 | + 'getStickerSet' => ['name', 'token', 'return_array', 'forgot', 'answer'], |
|
287 | + 'uploadStickerFile' => ['png_sticker', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
288 | + 'createNewStickerSet' => ['name', 'title', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'contains_masks', 'mask_position', 'token', 'return_array', 'forgot', 'answer'], |
|
289 | + 'addStickerToSet' => ['name', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'mask_position', 'token', 'return_array', 'forgot', 'answer'], |
|
290 | + 'setStickerPositionInSet' => ['sticker', 'position', 'token', 'return_array', 'forgot', 'answer'], |
|
291 | + 'deleteStickerFromSet' => ['sticker', 'token', 'return_array', 'forgot', 'answer'], |
|
292 | + 'setStickerSetThumb' => ['name', 'user_id', 'thumb', 'token', 'return_array', 'forgot', 'answer'], |
|
293 | + 'answerInlineQuery' => ['results', 'inline_query_id', 'cache_time', 'is_personal', 'next_offset', 'switch_pm_text', 'switch_pm_parameter', 'token', 'return_array', 'forgot', 'answer'], |
|
294 | + 'answerWebAppQuery' => ['web_app_query_id', 'result', 'token', 'return_array', 'forgot', 'answer'], |
|
295 | + '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'], |
|
296 | + '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'], |
|
297 | + 'answerShippingQuery' => ['ok', 'shipping_query_id', 'shipping_options', 'error_message', 'token', 'return_array', 'forgot', 'answer'], |
|
298 | + 'answerPreCheckoutQuery' => ['ok', 'pre_checkout_query_id', 'error_message', 'token', 'return_array', 'forgot', 'answer'], |
|
299 | + 'setPassportDataErrors' => ['errors', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
300 | + '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'], |
|
301 | + 'setGameScore' => ['score', 'user_id', 'force', 'disable_edit_message', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
302 | + 'getGameHighScores' => ['user_id', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
303 | 303 | ]; |
304 | 304 | |
305 | 305 | private const METHODS_WITH_FILE = [ |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | 'logOut' => [], |
329 | 329 | 'close' => [], |
330 | 330 | 'sendMessage' => ['chat_id'], |
331 | - 'forwardMessage' => ['from_chat_id','message_id'], |
|
332 | - 'copyMessage' => ['from_chat_id','message_id'], |
|
331 | + 'forwardMessage' => ['from_chat_id', 'message_id'], |
|
332 | + 'copyMessage' => ['from_chat_id', 'message_id'], |
|
333 | 333 | 'sendPhoto' => ['chat_id'], |
334 | 334 | 'sendAudio' => ['chat_id'], |
335 | 335 | 'sendDocument' => ['chat_id'], |
@@ -345,15 +345,15 @@ discard block |
||
345 | 345 | 'sendContact' => ['chat_id'], |
346 | 346 | 'sendPoll' => ['chat_id'], |
347 | 347 | 'sendDice' => ['chat_id'], |
348 | - 'sendChatAction' => ['chat_id','action'], |
|
348 | + 'sendChatAction' => ['chat_id', 'action'], |
|
349 | 349 | 'getUserProfilePhotos' => ['user_id'], |
350 | 350 | 'getFile' => ['file_id'], |
351 | - 'banChatMember' => ['chat_id','user_id'], |
|
352 | - 'kickChatMember' => ['chat_id','user_id'], |
|
353 | - 'unbanChatMember' => ['chat_id','user_id'], |
|
354 | - 'restrictChatMember' => ['chat_id','user_id'], |
|
355 | - 'promoteChatMember' => ['chat_id','user_id'], |
|
356 | - 'setChatAdministratorCustomTitle' => ['chat_id','user_id'], |
|
351 | + 'banChatMember' => ['chat_id', 'user_id'], |
|
352 | + 'kickChatMember' => ['chat_id', 'user_id'], |
|
353 | + 'unbanChatMember' => ['chat_id', 'user_id'], |
|
354 | + 'restrictChatMember' => ['chat_id', 'user_id'], |
|
355 | + 'promoteChatMember' => ['chat_id', 'user_id'], |
|
356 | + 'setChatAdministratorCustomTitle' => ['chat_id', 'user_id'], |
|
357 | 357 | 'banChatSenderChat' => ['chat_id'], |
358 | 358 | 'unbanChatSenderChat' => ['chat_id'], |
359 | 359 | 'setChatPermissions' => ['chat_id'], |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | 'createChatInviteLink' => ['chat_id'], |
362 | 362 | 'editChatInviteLink' => ['chat_id'], |
363 | 363 | 'revokeChatInviteLink' => ['chat_id'], |
364 | - 'approveChatJoinRequest' => ['chat_id','user_id'], |
|
365 | - 'declineChatJoinRequest' => ['chat_id','user_id'], |
|
364 | + 'approveChatJoinRequest' => ['chat_id', 'user_id'], |
|
365 | + 'declineChatJoinRequest' => ['chat_id', 'user_id'], |
|
366 | 366 | 'setChatPhoto' => ['chat_id'], |
367 | 367 | 'deleteChatPhoto' => ['chat_id'], |
368 | 368 | 'setChatTitle' => ['chat_id'], |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | 'getChat' => ['chat_id'], |
375 | 375 | 'getChatAdministrators' => ['chat_id'], |
376 | 376 | 'getChatMembersCount' => ['chat_id'], |
377 | - 'getChatMember' => ['chat_id','user_id'], |
|
377 | + 'getChatMember' => ['chat_id', 'user_id'], |
|
378 | 378 | 'setChatStickerSet' => ['chat_id'], |
379 | 379 | 'deleteChatStickerSet' => ['chat_id'], |
380 | 380 | 'answerCallbackQuery' => ['callback_query_id'], |
@@ -385,12 +385,12 @@ discard block |
||
385 | 385 | 'getChatMenuButton' => [], |
386 | 386 | 'setMyDefaultAdministratorRights' => [], |
387 | 387 | 'getMyDefaultAdministratorRights' => [], |
388 | - 'editMessageText' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
389 | - 'editMessageCaption' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
390 | - 'editMessageMedia' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
391 | - 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
392 | - 'stopPoll' => ['chat_id','message_id'], |
|
393 | - 'deleteMessage' => ['chat_id','message_id'], |
|
388 | + 'editMessageText' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
389 | + 'editMessageCaption' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
390 | + 'editMessageMedia' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
391 | + 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
392 | + 'stopPoll' => ['chat_id', 'message_id'], |
|
393 | + 'deleteMessage' => ['chat_id', 'message_id'], |
|
394 | 394 | 'sendSticker' => ['chat_id'], |
395 | 395 | 'getStickerSet' => [], |
396 | 396 | 'uploadStickerFile' => ['user_id'], |
@@ -406,29 +406,29 @@ discard block |
||
406 | 406 | 'answerPreCheckoutQuery' => ['pre_checkout_query_id'], |
407 | 407 | 'setPassportDataErrors' => ['user_id'], |
408 | 408 | 'sendGame' => ['chat_id'], |
409 | - 'setGameScore' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
410 | - 'getGameHighScores' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']] |
|
409 | + 'setGameScore' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
410 | + 'getGameHighScores' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']] |
|
411 | 411 | ]; |
412 | 412 | |
413 | 413 | |
414 | - public static function __callStatic (string $name, array $arguments) { |
|
414 | + public static function __callStatic(string $name, array $arguments) { |
|
415 | 415 | if ($action = self::methodAction($name)) { |
416 | - self::keysName($action,$arguments); |
|
417 | - self::readyFile($action,$arguments); |
|
418 | - self::setDefaults($action,$arguments); |
|
416 | + self::keysName($action, $arguments); |
|
417 | + self::readyFile($action, $arguments); |
|
418 | + self::setDefaults($action, $arguments); |
|
419 | 419 | if (isset($arguments['answer'])) { |
420 | - return answer::init($action,$arguments); |
|
420 | + return answer::init($action, $arguments); |
|
421 | 421 | } |
422 | 422 | else { |
423 | - return curl::init($action,$arguments); |
|
423 | + return curl::init($action, $arguments); |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | else { |
427 | - logger::write("$name method is not supported",loggerTypes::ERROR); |
|
427 | + logger::write("$name method is not supported", loggerTypes::ERROR); |
|
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
431 | - private static function keysName (string $name, array &$arguments) { |
|
431 | + private static function keysName(string $name, array &$arguments) { |
|
432 | 432 | foreach ($arguments as $key => $argument) { |
433 | 433 | if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) { |
434 | 434 | $arguments[self::METHODS_KEYS[$name][$key]] = $argument; |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | - private static function methodAction(string $name): string|false { |
|
440 | + private static function methodAction(string $name): string | false { |
|
441 | 441 | return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false; |
442 | 442 | } |
443 | 443 | |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | } |
459 | 459 | } |
460 | 460 | |
461 | - private static function methodFile(string $name): array|false { |
|
461 | + private static function methodFile(string $name): array | false { |
|
462 | 462 | return self::METHODS_WITH_FILE[$name] ?? false; |
463 | 463 | } |
464 | 464 | |
@@ -466,13 +466,13 @@ discard block |
||
466 | 466 | $defaults = self::METHODS_EXTRA_DEFAULTS[$name]; |
467 | 467 | foreach ($defaults as $key => $default) { |
468 | 468 | if (is_numeric($key)) { |
469 | - if (!isset($arguments[$default])){ |
|
469 | + if (!isset($arguments[$default])) { |
|
470 | 470 | $arguments[$default] = self::catchFields($default); |
471 | 471 | } |
472 | 472 | } |
473 | 473 | elseif (isset(BPT::$update->$key) || $key === 'other') { |
474 | 474 | foreach ($default as $def) { |
475 | - if (!isset($arguments[$def])){ |
|
475 | + if (!isset($arguments[$def])) { |
|
476 | 476 | $arguments[$def] = self::catchFields($def); |
477 | 477 | } |
478 | 478 | } |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | } |
482 | 482 | } |
483 | 483 | |
484 | - public static function catchFields (string $field): int|string|bool { |
|
484 | + public static function catchFields(string $field): int | string | bool { |
|
485 | 485 | switch ($field) { |
486 | 486 | case 'chat_id' : |
487 | 487 | case 'from_chat_id' : |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | default => false |
618 | 618 | }; |
619 | 619 | case 'url' : |
620 | - return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
620 | + return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
621 | 621 | default: |
622 | 622 | return false; |
623 | 623 | } |
@@ -418,12 +418,10 @@ discard block |
||
418 | 418 | self::setDefaults($action,$arguments); |
419 | 419 | if (isset($arguments['answer'])) { |
420 | 420 | return answer::init($action,$arguments); |
421 | - } |
|
422 | - else { |
|
421 | + } else { |
|
423 | 422 | return curl::init($action,$arguments); |
424 | 423 | } |
425 | - } |
|
426 | - else { |
|
424 | + } else { |
|
427 | 425 | logger::write("$name method is not supported",loggerTypes::ERROR); |
428 | 426 | } |
429 | 427 | } |
@@ -448,8 +446,7 @@ discard block |
||
448 | 446 | $arguments['media'][$key]['media'] = new CURLFile($media['media']); |
449 | 447 | } |
450 | 448 | } |
451 | - } |
|
452 | - elseif ($file_params = self::methodFile($name)) { |
|
449 | + } elseif ($file_params = self::methodFile($name)) { |
|
453 | 450 | foreach ($file_params as $param) { |
454 | 451 | if (isset($arguments[$param]) && file_exists($arguments[$param])) { |
455 | 452 | $arguments[$param] = new CURLFile($arguments[$param]); |
@@ -469,8 +466,7 @@ discard block |
||
469 | 466 | if (!isset($arguments[$default])){ |
470 | 467 | $arguments[$default] = self::catchFields($default); |
471 | 468 | } |
472 | - } |
|
473 | - elseif (isset(BPT::$update->$key) || $key === 'other') { |
|
469 | + } elseif (isset(BPT::$update->$key) || $key === 'other') { |
|
474 | 470 | foreach ($default as $def) { |
475 | 471 | if (!isset($arguments[$def])){ |
476 | 472 | $arguments[$def] = self::catchFields($def); |
@@ -510,9 +506,13 @@ discard block |
||
510 | 506 | default => false |
511 | 507 | }; |
512 | 508 | case 'file_id' : |
513 | - if (isset(BPT::$update->message)) $type = 'message'; |
|
514 | - elseif (isset(BPT::$update->edited_message)) $type = 'edited_message'; |
|
515 | - else return false; |
|
509 | + if (isset(BPT::$update->message)) { |
|
510 | + $type = 'message'; |
|
511 | + } elseif (isset(BPT::$update->edited_message)) { |
|
512 | + $type = 'edited_message'; |
|
513 | + } else { |
|
514 | + return false; |
|
515 | + } |
|
516 | 516 | |
517 | 517 | return match(true) { |
518 | 518 | isset(BPT::$update->$type->animation) => BPT::$update->$type->animation->file_id, |
@@ -219,18 +219,18 @@ discard block |
||
219 | 219 | * @method getGameHighScores (int|null|array $user_id = null, int|null $chat_id = null, int|null $message_id = null, string|null $inline_message_id = null, string|null $token = null, bool|null $return_array = null, bool|null $forgot = null, bool|null $answer = null) Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects. |
220 | 220 | * @method getGameHigh (int|null|array $user_id = null, int|null $chat_id = null, int|null $message_id = null, string|null $inline_message_id = null, string|null $token = null, bool|null $return_array = null, bool|null $forgot = null, bool|null $answer = null) Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects. |
221 | 221 | */ |
222 | -class BPT{ |
|
222 | +class BPT { |
|
223 | 223 | public static update $update; |
224 | 224 | |
225 | 225 | public static BPT $handler; |
226 | 226 | |
227 | 227 | |
228 | - public function __construct (array|stdClass $settings) { |
|
228 | + public function __construct(array | stdClass $settings) { |
|
229 | 229 | static::$handler = &$this; |
230 | 230 | settings::init($settings); |
231 | 231 | } |
232 | 232 | |
233 | - public function __call (string $name, array $arguments) { |
|
233 | + public function __call(string $name, array $arguments) { |
|
234 | 234 | if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) { |
235 | 235 | return request::$name(...$arguments[0]); |
236 | 236 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | - public static function exit (string|null $message = null) { |
|
242 | + public static function exit (string | null $message = null) { |
|
243 | 243 | die($message ?? "<div style='width:98vw;height:98vh;display:flex;justify-content:center;align-items:center;font-size:25vw'>BPT</div>"); |
244 | 244 | } |
245 | 245 | } |
@@ -233,8 +233,7 @@ |
||
233 | 233 | public function __call (string $name, array $arguments) { |
234 | 234 | if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) { |
235 | 235 | return request::$name(...$arguments[0]); |
236 | - } |
|
237 | - else { |
|
236 | + } else { |
|
238 | 237 | return request::$name(...$arguments); |
239 | 238 | } |
240 | 239 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public static int $log_size = 10; |
24 | 24 | |
25 | - public static string|CURLFile|null $certificate = null; |
|
25 | + public static string | CURLFile | null $certificate = null; |
|
26 | 26 | |
27 | 27 | public static bool $handler = true; |
28 | 28 | |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | |
53 | 53 | public static array $allowed_updates = ['message', 'edited_channel_post', 'callback_query', 'inline_query']; |
54 | 54 | |
55 | - public static array|mysqli|null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json']; |
|
55 | + public static array | mysqli | null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json']; |
|
56 | 56 | |
57 | 57 | |
58 | - public static function init (array|stdClass $settings) { |
|
58 | + public static function init(array | stdClass $settings) { |
|
59 | 59 | $settings = (array) $settings; |
60 | 60 | |
61 | 61 | if (!(isset($settings['logger']) && $settings['logger'] == false)) { |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | foreach ($settings as $setting => $value) { |
66 | - try{ |
|
66 | + try { |
|
67 | 67 | self::$$setting = $value; |
68 | 68 | } |
69 | - catch (TypeError){ |
|
70 | - logger::write("$setting setting has wrong type , its set to default value",loggerTypes::WARNING); |
|
69 | + catch (TypeError) { |
|
70 | + logger::write("$setting setting has wrong type , its set to default value", loggerTypes::WARNING); |
|
71 | 71 | } |
72 | - catch (Error){ |
|
73 | - logger::write("$setting setting is not one of library settings",loggerTypes::WARNING); |
|
72 | + catch (Error) { |
|
73 | + logger::write("$setting setting is not one of library settings", loggerTypes::WARNING); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates(); |
83 | 83 | } |
84 | 84 | else { |
85 | - logger::write('token format is not right, check it and try again',loggerTypes::ERROR); |
|
85 | + logger::write('token format is not right, check it and try again', loggerTypes::ERROR); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | else { |
89 | - logger::write('You must specify token parameter in settings',loggerTypes::ERROR); |
|
89 | + logger::write('You must specify token parameter in settings', loggerTypes::ERROR); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | if (self::$secure_folder) { |
110 | 110 | $address = explode('/', $_SERVER['REQUEST_URI']); |
111 | 111 | unset($address[count($address) - 1]); |
112 | - $address = implode('/', $address) . '/BPT.php'; |
|
112 | + $address = implode('/', $address).'/BPT.php'; |
|
113 | 113 | $text = "ErrorDocument 404 $address\nErrorDocument 403 $address\n Options -Indexes\n Order Deny,Allow\nDeny from all\nAllow from 127.0.0.1\n<Files *.php>\n Order Allow,Deny\n Allow from all\n</Files>"; |
114 | 114 | if (!file_exists('.htaccess') || filesize('.htaccess') != strlen($text)) { |
115 | 115 | file_put_contents('.htaccess', $text); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | getUpdates::init(); |
129 | 129 | } |
130 | 130 | else { |
131 | - logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler',loggerTypes::ERROR); |
|
131 | + logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler', loggerTypes::ERROR); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 |
@@ -65,11 +65,9 @@ discard block |
||
65 | 65 | foreach ($settings as $setting => $value) { |
66 | 66 | try{ |
67 | 67 | self::$$setting = $value; |
68 | - } |
|
69 | - catch (TypeError){ |
|
68 | + } catch (TypeError){ |
|
70 | 69 | logger::write("$setting setting has wrong type , its set to default value",loggerTypes::WARNING); |
71 | - } |
|
72 | - catch (Error){ |
|
70 | + } catch (Error){ |
|
73 | 71 | logger::write("$setting setting is not one of library settings",loggerTypes::WARNING); |
74 | 72 | } |
75 | 73 | } |
@@ -80,12 +78,10 @@ discard block |
||
80 | 78 | self::secureFolder(); |
81 | 79 | self::db(); |
82 | 80 | self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates(); |
83 | - } |
|
84 | - else { |
|
81 | + } else { |
|
85 | 82 | logger::write('token format is not right, check it and try again',loggerTypes::ERROR); |
86 | 83 | } |
87 | - } |
|
88 | - else { |
|
84 | + } else { |
|
89 | 85 | logger::write('You must specify token parameter in settings',loggerTypes::ERROR); |
90 | 86 | } |
91 | 87 | } |
@@ -126,8 +122,7 @@ discard block |
||
126 | 122 | private static function getUpdates() { |
127 | 123 | if (self::$handler) { |
128 | 124 | getUpdates::init(); |
129 | - } |
|
130 | - else { |
|
125 | + } else { |
|
131 | 126 | logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler',loggerTypes::ERROR); |
132 | 127 | } |
133 | 128 | } |
@@ -26,12 +26,12 @@ |
||
26 | 26 | $this->$key[$sub_key][] = new ($subs['array']['array'][$key]) ($sub2_value); |
27 | 27 | } |
28 | 28 | } |
29 | - else{ |
|
29 | + else { |
|
30 | 30 | $this->$key[] = new ($subs['array'][$key]) ($sub_value); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | } |
34 | - else{ |
|
34 | + else { |
|
35 | 35 | $this->$key = $value; |
36 | 36 | if (ucfirst($key) === basename(get_class($this)).'_id') { |
37 | 37 | $this->{'id'} = $value; |
@@ -17,21 +17,18 @@ |
||
17 | 17 | foreach ($object as $key=>$value) { |
18 | 18 | if (isset($subs[$key])) { |
19 | 19 | $this->$key = new ($subs[$key]) ($value); |
20 | - } |
|
21 | - else { |
|
20 | + } else { |
|
22 | 21 | if (is_array($value)) { |
23 | 22 | foreach ($value as $sub_key=>$sub_value) { |
24 | 23 | if (is_array($sub_value)) { |
25 | 24 | foreach ($sub_value as $sub2_value) { |
26 | 25 | $this->$key[$sub_key][] = new ($subs['array']['array'][$key]) ($sub2_value); |
27 | 26 | } |
28 | - } |
|
29 | - else{ |
|
27 | + } else{ |
|
30 | 28 | $this->$key[] = new ($subs['array'][$key]) ($sub_value); |
31 | 29 | } |
32 | 30 | } |
33 | - } |
|
34 | - else{ |
|
31 | + } else{ |
|
35 | 32 | $this->$key = $value; |
36 | 33 | if (ucfirst($key) === basename(get_class($this)).'_id') { |
37 | 34 | $this->{'id'} = $value; |