@@ -24,7 +24,7 @@ |
||
24 | 24 | public shippingAddress $shipping_address; |
25 | 25 | |
26 | 26 | |
27 | - public function __construct(stdClass|null $object = null) { |
|
27 | + public function __construct(stdClass | null $object = null) { |
|
28 | 28 | if ($object != null) { |
29 | 29 | parent::__construct($object, self::subs); |
30 | 30 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | public int $duration; |
54 | 54 | |
55 | 55 | |
56 | - public function __construct(stdClass|null $object = null) { |
|
56 | + public function __construct(stdClass | null $object = null) { |
|
57 | 57 | if ($object != null) { |
58 | 58 | parent::__construct($object, self::subs); |
59 | 59 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | public int $score; |
22 | 22 | |
23 | 23 | |
24 | - public function __construct(stdClass|null $object = null) { |
|
24 | + public function __construct(stdClass | null $object = null) { |
|
25 | 25 | if ($object != null) { |
26 | 26 | parent::__construct($object, self::subs); |
27 | 27 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the |
53 | 53 | * thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
54 | 54 | */ |
55 | - public CURLFile|string $thumb; |
|
55 | + public CURLFile | string $thumb; |
|
56 | 56 | |
57 | 57 | /** `video` and `animation` only. width */ |
58 | 58 | public int $width; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public bool $disable_content_type_detection; |
80 | 80 | |
81 | 81 | |
82 | - public function __construct(stdClass|null $object = null) { |
|
82 | + public function __construct(stdClass | null $object = null) { |
|
83 | 83 | if ($object != null) { |
84 | 84 | parent::__construct($object, self::subs); |
85 | 85 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | use CURLFile; |
14 | 14 | |
15 | 15 | class webhook extends receiver { |
16 | - public static function init () { |
|
16 | + public static function init() { |
|
17 | 17 | if (settings::$multi) { |
18 | 18 | multi::init(); |
19 | 19 | } |
@@ -42,26 +42,26 @@ discard block |
||
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | - protected static function setWebhook(string $url,string $secret = '') { |
|
45 | + protected static function setWebhook(string $url, string $secret = '') { |
|
46 | 46 | $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 | 47 | if (telegram::$status) { |
48 | - logger::write('Webhook was set successfully',loggerTypes::INFO); |
|
48 | + logger::write('Webhook was set successfully', loggerTypes::INFO); |
|
49 | 49 | } |
50 | 50 | else { |
51 | - logger::write("There is some problem happened , telegram response : \n".json_encode($res),loggerTypes::ERROR); |
|
52 | - BPT::exit(print_r($res,true)); |
|
51 | + logger::write("There is some problem happened , telegram response : \n".json_encode($res), loggerTypes::ERROR); |
|
52 | + BPT::exit(print_r($res, true)); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | 56 | protected static function checkURL() { |
57 | 57 | if (!(isset($_SERVER['SERVER_NAME']) && isset($_SERVER['REQUEST_URI']))) { |
58 | - logger::write('For using webhook receiver , you should open this file in your webserver(by domain)',loggerTypes::ERROR); |
|
58 | + logger::write('For using webhook receiver , you should open this file in your webserver(by domain)', loggerTypes::ERROR); |
|
59 | 59 | throw new bptException('WEBHOOK_NEED_URL'); |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | 63 | private static function setURL(): string { |
64 | - return (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME']; |
|
64 | + return (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | protected static function setCertificate() { |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | self::setCertificate(); |
84 | 84 | $url = self::setURL(); |
85 | 85 | $secret = settings::$secret ?? tools::randomString(64); |
86 | - self::setWebhook($url,$secret); |
|
87 | - lock::save('BPT-HOOK',$secret); |
|
86 | + self::setWebhook($url, $secret); |
|
87 | + lock::save('BPT-HOOK', $secret); |
|
88 | 88 | BPT::exit('Done'); |
89 | 89 | } |
90 | 90 | |
91 | 91 | private static function checkSecret() { |
92 | 92 | $secret = lock::read('BPT-HOOK'); |
93 | 93 | if ($secret !== self::getSecret()) { |
94 | - logger::write('This is not webhook set by BPT, webhook will reset',loggerTypes::WARNING); |
|
94 | + logger::write('This is not webhook set by BPT, webhook will reset', loggerTypes::WARNING); |
|
95 | 95 | self::processSetWebhook(); |
96 | 96 | } |
97 | 97 | } |
@@ -16,15 +16,13 @@ discard block |
||
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 | receiver::processUpdate(); |
25 | 24 | logger::write('Update received , lets process it ;)'); |
26 | - } |
|
27 | - else { |
|
25 | + } else { |
|
28 | 26 | self::processSetWebhook(); |
29 | 27 | } |
30 | 28 | } |
@@ -46,8 +44,7 @@ discard block |
||
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 |
||
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 | } |
@@ -73,26 +73,21 @@ |
||
73 | 73 | if (self::handlerExist('message')) { |
74 | 74 | BPT::$handler->message(BPT::$update->message); |
75 | 75 | } |
76 | - } |
|
77 | - elseif (isset(BPT::$update->callback_query)) { |
|
76 | + } elseif (isset(BPT::$update->callback_query)) { |
|
78 | 77 | if (self::handlerExist('callback_query')) { |
79 | 78 | BPT::$handler->callback_query(BPT::$update->callback_query); |
80 | 79 | } |
81 | - } |
|
82 | - elseif (isset(BPT::$update->inline_query)) { |
|
80 | + } elseif (isset(BPT::$update->inline_query)) { |
|
83 | 81 | if (self::handlerExist('inline_query')) { |
84 | 82 | BPT::$handler->inline_query(BPT::$update->inline_query); |
85 | 83 | } |
86 | - } |
|
87 | - elseif (isset(BPT::$update->edited_message)) { |
|
84 | + } elseif (isset(BPT::$update->edited_message)) { |
|
88 | 85 | if (self::handlerExist('edited_message')) { |
89 | 86 | BPT::$handler->edited_message(BPT::$update->edited_message); |
90 | 87 | } |
91 | - } |
|
92 | - elseif (self::handlerExist('something_else')) { |
|
88 | + } elseif (self::handlerExist('something_else')) { |
|
93 | 89 | BPT::$handler->something_else(BPT::$update); |
94 | - } |
|
95 | - else { |
|
90 | + } else { |
|
96 | 91 | logger::write('Update received but handlers does not set',loggerTypes::WARNING); |
97 | 92 | } |
98 | 93 | } |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | protected static function telegramVerify(string $ip = null): void { |
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::WARNING); |
|
25 | + logger::write('not authorized access denied. IP : '.$ip ?? $_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING); |
|
26 | 26 | BPT::exit(); |
27 | 27 | } |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | - protected static function processUpdate(string|stdClass|update $update = null): void { |
|
31 | + protected static function processUpdate(string | stdClass | update $update = null): void { |
|
32 | 32 | if (!is_object($update)) { |
33 | 33 | $update = json_decode($update ?? file_get_contents("php://input")); |
34 | 34 | if (!$update) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | - if (!is_a($update,'update')) { |
|
39 | + if (!is_a($update, 'update')) { |
|
40 | 40 | $update = new update($update); |
41 | 41 | } |
42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | self::processHandler(); |
46 | 46 | } |
47 | 47 | |
48 | - protected static function setMessageExtra (update &$update): void { |
|
48 | + protected static function setMessageExtra(update & $update): void { |
|
49 | 49 | if ((isset($update->message) && isset($update->message->text)) || (isset($update->edited_message) && isset($update->edited_message->text))) { |
50 | 50 | $type = isset($update->message) ? 'message' : 'edited_message'; |
51 | 51 | $text = &$update->$type->text; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | BPT::$handler->something_else(BPT::$update); |
94 | 94 | } |
95 | 95 | else { |
96 | - logger::write('Update received but handlers does not set',loggerTypes::WARNING); |
|
96 | + logger::write('Update received but handlers does not set', loggerTypes::WARNING); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return string|bool|array{hash:string, key:string, iv:string} |
30 | 30 | * @throws bptException |
31 | 31 | */ |
32 | - public static function crypto (string $action, string $text, string $key = null, string $iv = null): bool|array|string { |
|
32 | + public static function crypto(string $action, string $text, string $key = null, string $iv = null): bool | array | string { |
|
33 | 33 | if (extension_loaded('openssl')) { |
34 | 34 | if ($action === cryptoAction::ENCRYPT) { |
35 | 35 | $key = self::randomString(64); |
@@ -39,22 +39,22 @@ discard block |
||
39 | 39 | } |
40 | 40 | elseif ($action === cryptoAction::DECRYPT) { |
41 | 41 | if (empty($key)) { |
42 | - logger::write("tools::crypto function used\nkey parameter is not set",loggerTypes::ERROR); |
|
42 | + logger::write("tools::crypto function used\nkey parameter is not set", loggerTypes::ERROR); |
|
43 | 43 | throw new bptException('ARGUMENT_NOT_FOUND_KEY'); |
44 | 44 | } |
45 | 45 | elseif (empty($iv)) { |
46 | - logger::write("tools::crypto function used\niv parameter is not set",loggerTypes::ERROR); |
|
46 | + logger::write("tools::crypto function used\niv parameter is not set", loggerTypes::ERROR); |
|
47 | 47 | throw new bptException('ARGUMENT_NOT_FOUND_IV'); |
48 | 48 | } |
49 | 49 | return openssl_decrypt(base64_decode($text), 'AES-256-CBC', $key, 1, $iv); |
50 | 50 | } |
51 | 51 | else { |
52 | - logger::write("tools::crypto function used\naction is not right, its must be `encode` or `decode`",loggerTypes::WARNING); |
|
52 | + logger::write("tools::crypto function used\naction is not right, its must be `encode` or `decode`", loggerTypes::WARNING); |
|
53 | 53 | return false; |
54 | 54 | } |
55 | 55 | } |
56 | 56 | else { |
57 | - logger::write("tools::crypto function used\nopenssl extension is not found , It may not be installed or enabled",loggerTypes::ERROR); |
|
57 | + logger::write("tools::crypto function used\nopenssl extension is not found , It may not be installed or enabled", loggerTypes::ERROR); |
|
58 | 58 | throw new bptException('OPENSSL_EXTENSION_MISSING'); |
59 | 59 | } |
60 | 60 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | public static function shortEncode(int $num): string { |
72 | 72 | $codes = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
73 | 73 | $array = []; |
74 | - while ($num > 0){ |
|
74 | + while ($num > 0) { |
|
75 | 75 | $array[] = $num % 62; |
76 | 76 | $num = floor($num / 62); |
77 | 77 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | foreach ($array as &$value) { |
80 | 80 | $value = $codes[$value]; |
81 | 81 | } |
82 | - return strrev(implode('',$array)); |
|
82 | + return strrev(implode('', $array)); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $num = 0; |
97 | 97 | $text = str_split(strrev($text)); |
98 | 98 | foreach ($text as $key=>$value) { |
99 | - $num += strpos($codes,$value) * pow(62,$key); |
|
99 | + $num += strpos($codes, $value) * pow(62, $key); |
|
100 | 100 | } |
101 | 101 | return $num; |
102 | 102 | } |
@@ -36,24 +36,20 @@ discard block |
||
36 | 36 | $iv = self::randomString(); |
37 | 37 | $output = base64_encode(openssl_encrypt($text, 'AES-256-CBC', $key, 1, $iv)); |
38 | 38 | return ['hash' => $output, 'key' => $key, 'iv' => $iv]; |
39 | - } |
|
40 | - elseif ($action === cryptoAction::DECRYPT) { |
|
39 | + } elseif ($action === cryptoAction::DECRYPT) { |
|
41 | 40 | if (empty($key)) { |
42 | 41 | logger::write("tools::crypto function used\nkey parameter is not set",loggerTypes::ERROR); |
43 | 42 | throw new bptException('ARGUMENT_NOT_FOUND_KEY'); |
44 | - } |
|
45 | - elseif (empty($iv)) { |
|
43 | + } elseif (empty($iv)) { |
|
46 | 44 | logger::write("tools::crypto function used\niv parameter is not set",loggerTypes::ERROR); |
47 | 45 | throw new bptException('ARGUMENT_NOT_FOUND_IV'); |
48 | 46 | } |
49 | 47 | return openssl_decrypt(base64_decode($text), 'AES-256-CBC', $key, 1, $iv); |
50 | - } |
|
51 | - else { |
|
48 | + } else { |
|
52 | 49 | logger::write("tools::crypto function used\naction is not right, its must be `encode` or `decode`",loggerTypes::WARNING); |
53 | 50 | return false; |
54 | 51 | } |
55 | - } |
|
56 | - else { |
|
52 | + } else { |
|
57 | 53 | logger::write("tools::crypto function used\nopenssl extension is not found , It may not be installed or enabled",loggerTypes::ERROR); |
58 | 54 | throw new bptException('OPENSSL_EXTENSION_MISSING'); |
59 | 55 | } |
@@ -75,7 +71,9 @@ discard block |
||
75 | 71 | $array[] = $num % 62; |
76 | 72 | $num = floor($num / 62); |
77 | 73 | } |
78 | - if (count($array) < 1) $array = [0]; |
|
74 | + if (count($array) < 1) { |
|
75 | + $array = [0]; |
|
76 | + } |
|
79 | 77 | foreach ($array as &$value) { |
80 | 78 | $value = $codes[$value]; |
81 | 79 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | private static $handler; |
13 | 13 | |
14 | 14 | |
15 | - public static function init (int $log_size = 10): void { |
|
15 | + public static function init(int $log_size = 10): void { |
|
16 | 16 | self::$log_size = $log_size; |
17 | 17 | if (file_exists(settings::$name.'BPT.log') && !(filesize(settings::$name.'BPT.log') > self::$log_size * 1024 * 1024)) { |
18 | 18 | $mode = 'a'; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | self::$handler = fopen(settings::$name.'BPT.log', $mode); |
26 | 26 | |
27 | 27 | if ($write) { |
28 | - fwrite(self::$handler,"♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nTnx for using our library\nSome information about us :\nAuthor : @Im_Miaad\nHelper : @A_LiReza_ME\nChannel : @BPT_CH\nOur Website : https://bptlib.ir\n\nIf you have any problem with our library\nContact to our supports\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nINFO : BPT Library LOG STARTED ...\nwarning : this file automatically deleted when its size reached log_size setting, do not delete it manually\n\n"); |
|
28 | + fwrite(self::$handler, "♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nTnx for using our library\nSome information about us :\nAuthor : @Im_Miaad\nHelper : @A_LiReza_ME\nChannel : @BPT_CH\nOur Website : https://bptlib.ir\n\nIf you have any problem with our library\nContact to our supports\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nINFO : BPT Library LOG STARTED ...\nwarning : this file automatically deleted when its size reached log_size setting, do not delete it manually\n\n"); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | if (self::$waited_logs != []) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | public static function write(string $data, string $type = loggerTypes::NONE): void { |
39 | - $text = date('Y/m/d H:i:s') . ( $type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n" ); |
|
39 | + $text = date('Y/m/d H:i:s').($type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n"); |
|
40 | 40 | if (!is_null(self::$handler)) { |
41 | 41 | fwrite(self::$handler, $text); |
42 | 42 | } |
@@ -17,8 +17,7 @@ discard block |
||
17 | 17 | if (file_exists(settings::$name.'BPT.log') && !(filesize(settings::$name.'BPT.log') > self::$log_size * 1024 * 1024)) { |
18 | 18 | $mode = 'a'; |
19 | 19 | $write = false; |
20 | - } |
|
21 | - else { |
|
20 | + } else { |
|
22 | 21 | $mode = 'w'; |
23 | 22 | $write = true; |
24 | 23 | } |
@@ -39,8 +38,7 @@ discard block |
||
39 | 38 | $text = date('Y/m/d H:i:s') . ( $type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n" ); |
40 | 39 | if (!is_null(self::$handler)) { |
41 | 40 | fwrite(self::$handler, $text); |
42 | - } |
|
43 | - else { |
|
41 | + } else { |
|
44 | 42 | self::$waited_logs[] = $text; |
45 | 43 | } |
46 | 44 | } |
@@ -10,17 +10,17 @@ 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 | $handler = $info['handler']; |
17 | - self::setTimeout($data,$handler,$method); |
|
17 | + self::setTimeout($data, $handler, $method); |
|
18 | 18 | self::setData($data); |
19 | 19 | $data['method'] = $method; |
20 | 20 | curl_setopt($handler, CURLOPT_POSTFIELDS, $data); |
21 | 21 | $result = curl_exec($handler); |
22 | 22 | if (curl_errno($handler)) { |
23 | - logger::write(curl_error($handler),loggerTypes::WARNING); |
|
23 | + logger::write(curl_error($handler), loggerTypes::WARNING); |
|
24 | 24 | } |
25 | 25 | if ($info['token'] != settings::$token) { |
26 | 26 | curl_close($handler); |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true); |
37 | 37 | curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
38 | 38 | } |
39 | - else{ |
|
39 | + else { |
|
40 | 40 | $token = settings::$token; |
41 | - if (!isset(self::$curl_handler)){ |
|
41 | + if (!isset(self::$curl_handler)) { |
|
42 | 42 | self::$curl_handler = curl_init(settings::$base_url."/bot$token/"); |
43 | 43 | curl_setopt(self::$curl_handler, CURLOPT_RETURNTRANSFER, true); |
44 | 44 | curl_setopt(self::$curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
@@ -54,22 +54,22 @@ discard block |
||
54 | 54 | ]; |
55 | 55 | } |
56 | 56 | |
57 | - private static function setTimeout(array &$data , CurlHandle $curl_handler,string $method): void { |
|
57 | + private static function setTimeout(array &$data, CurlHandle $curl_handler, string $method): void { |
|
58 | 58 | if (isset($data['forgot'])) { |
59 | 59 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time); |
60 | 60 | unset($data['forgot']); |
61 | 61 | } |
62 | - elseif ($method === 'getUpdates'){ |
|
62 | + elseif ($method === 'getUpdates') { |
|
63 | 63 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000); |
64 | 64 | } |
65 | - else{ |
|
65 | + else { |
|
66 | 66 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 300); |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | 70 | private static function setData(array &$data): void { |
71 | - foreach ($data as &$value){ |
|
72 | - if (is_array($value) || (is_object($value) && !is_a($value,'CURLFile'))){ |
|
71 | + foreach ($data as &$value) { |
|
72 | + if (is_array($value) || (is_object($value) && !is_a($value, 'CURLFile'))) { |
|
73 | 73 | $value = json_encode($value); |
74 | 74 | } |
75 | 75 | } |
@@ -35,8 +35,7 @@ discard block |
||
35 | 35 | $curl_handler = curl_init(settings::$base_url."/bot$token/"); |
36 | 36 | curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true); |
37 | 37 | curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
38 | - } |
|
39 | - else{ |
|
38 | + } else{ |
|
40 | 39 | $token = settings::$token; |
41 | 40 | if (!isset(self::$curl_handler)){ |
42 | 41 | self::$curl_handler = curl_init(settings::$base_url."/bot$token/"); |
@@ -58,11 +57,9 @@ discard block |
||
58 | 57 | if (isset($data['forgot'])) { |
59 | 58 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time); |
60 | 59 | unset($data['forgot']); |
61 | - } |
|
62 | - elseif ($method === 'getUpdates'){ |
|
60 | + } elseif ($method === 'getUpdates'){ |
|
63 | 61 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000); |
64 | - } |
|
65 | - else{ |
|
62 | + } else{ |
|
66 | 63 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 300); |
67 | 64 | } |
68 | 65 | } |