@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public int $file_size; |
39 | 39 | |
40 | 40 | |
41 | - public function __construct(stdClass|null $object = null) { |
|
41 | + public function __construct(stdClass | null $object = null) { |
|
42 | 42 | if ($object != null) { |
43 | 43 | parent::__construct($object, self::subs); |
44 | 44 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return bool|string string will be returned when destination doesn't set |
61 | 61 | */ |
62 | - public function download(string|null $destination = null): bool|string { |
|
63 | - return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.txt',$this->file_id); |
|
62 | + public function download(string | null $destination = null): bool | string { |
|
63 | + return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.txt', $this->file_id); |
|
64 | 64 | } |
65 | 65 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public string $big_file_unique_id; |
38 | 38 | |
39 | 39 | |
40 | - public function __construct(stdClass|null $object = null) { |
|
40 | + public function __construct(stdClass | null $object = null) { |
|
41 | 41 | if ($object != null) { |
42 | 42 | parent::__construct($object, self::subs); |
43 | 43 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return bool|string string will be returned when destination doesn't set |
61 | 61 | */ |
62 | - public function download(string|null $destination = null,bool $big = true): bool|string { |
|
63 | - return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4',$big ? $this->big_file_id : $this->small_file_id); |
|
62 | + public function download(string | null $destination = null, bool $big = true): bool | string { |
|
63 | + return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4', $big ? $this->big_file_id : $this->small_file_id); |
|
64 | 64 | } |
65 | 65 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public int $file_size; |
32 | 32 | |
33 | 33 | |
34 | - public function __construct(stdClass|null $object = null) { |
|
34 | + public function __construct(stdClass | null $object = null) { |
|
35 | 35 | if ($object != null) { |
36 | 36 | parent::__construct($object, self::subs); |
37 | 37 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return bool|string string will be returned when destination doesn't set |
54 | 54 | */ |
55 | - public function download(string|null $destination = null): bool|string { |
|
56 | - return telegram::downloadFile($destination ?? 'unknown.jpg',$this->file_id); |
|
55 | + public function download(string | null $destination = null): bool | string { |
|
56 | + return telegram::downloadFile($destination ?? 'unknown.jpg', $this->file_id); |
|
57 | 57 | } |
58 | 58 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public int $file_size; |
36 | 36 | |
37 | 37 | |
38 | - public function __construct(stdClass|null $object = null) { |
|
38 | + public function __construct(stdClass | null $object = null) { |
|
39 | 39 | if ($object != null) { |
40 | 40 | parent::__construct($object, self::subs); |
41 | 41 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return bool|string string will be returned when destination doesn't set |
58 | 58 | */ |
59 | - public function download(string|null $destination = null): bool|string { |
|
60 | - return telegram::downloadFile($destination ?? 'unknown.ogg',$this->file_id); |
|
59 | + public function download(string | null $destination = null): bool | string { |
|
60 | + return telegram::downloadFile($destination ?? 'unknown.ogg', $this->file_id); |
|
61 | 61 | } |
62 | 62 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public int $file_size; |
48 | 48 | |
49 | 49 | |
50 | - public function __construct(stdClass|null $object = null) { |
|
50 | + public function __construct(stdClass | null $object = null) { |
|
51 | 51 | if ($object != null) { |
52 | 52 | parent::__construct($object, self::subs); |
53 | 53 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return bool|string string will be returned when destination doesn't set |
70 | 70 | */ |
71 | - public function download(string|null $destination = null): bool|string { |
|
72 | - return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4',$this->file_id); |
|
71 | + public function download(string | null $destination = null): bool | string { |
|
72 | + return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4', $this->file_id); |
|
73 | 73 | } |
74 | 74 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return string|int|false string for formatted data , int for normal data , false when size can not be found(file not found or ...) |
28 | 28 | */ |
29 | - public static function size (string $path, bool $format = true): string|int|false { |
|
29 | + public static function size(string $path, bool $format = true): string | int | false { |
|
30 | 30 | if (filter_var($path, FILTER_VALIDATE_URL)) { |
31 | 31 | $ch = curl_init($path); |
32 | 32 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @return bool |
59 | 59 | * @throws bptException |
60 | 60 | */ |
61 | - public static function delete (string $path, bool $sub = true): bool { |
|
61 | + public static function delete(string $path, bool $sub = true): bool { |
|
62 | 62 | if (is_dir($path)) { |
63 | 63 | if (count(scandir($path)) > 2) { |
64 | 64 | if ($sub) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | return rmdir($path); |
71 | 71 | } |
72 | 72 | else { |
73 | - logger::write("tools::delete function used\ndelete function cannot delete folder because its have subFiles and sub parameter haven't true value",loggerTypes::ERROR); |
|
73 | + logger::write("tools::delete function used\ndelete function cannot delete folder because its have subFiles and sub parameter haven't true value", loggerTypes::ERROR); |
|
74 | 74 | throw new bptException('DELETE_FOLDER_HAS_SUB'); |
75 | 75 | } |
76 | 76 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @return bool |
91 | 91 | * @throws bptException when zip extension not found |
92 | 92 | */ |
93 | - public static function zip (string $path, string $destination): bool { |
|
93 | + public static function zip(string $path, string $destination): bool { |
|
94 | 94 | if (extension_loaded('zip')) { |
95 | 95 | $rootPath = realpath($path); |
96 | 96 | $zip = new ZipArchive(); |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return bool true on success and false in failure |
129 | 129 | */ |
130 | - public static function downloadFile (string $url, string $path,int $chunk_size = 512): bool { |
|
130 | + public static function downloadFile(string $url, string $path, int $chunk_size = 512): bool { |
|
131 | 131 | $file = fopen($url, 'rb'); |
132 | 132 | if (!$file) return false; |
133 | 133 | $path = fopen($path, 'wb'); |
134 | 134 | if (!$path) return false; |
135 | 135 | |
136 | 136 | $length = $chunk_size * 1024; |
137 | - while (!feof($file)){ |
|
137 | + while (!feof($file)) { |
|
138 | 138 | fwrite($path, fread($file, $length), $length); |
139 | 139 | } |
140 | 140 | fclose($path); |
@@ -16,17 +16,17 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * @internal Only for BPT self usage , Don't use it in your source! |
18 | 18 | */ |
19 | - public static function init(string $method,array $data) { |
|
19 | + public static function init(string $method, array $data) { |
|
20 | 20 | $info = self::getInfo($data); |
21 | 21 | $data = $info['data']; |
22 | 22 | $handler = $info['handler']; |
23 | - self::setTimeout($data,$handler,$method); |
|
23 | + self::setTimeout($data, $handler, $method); |
|
24 | 24 | self::setData($data); |
25 | 25 | $data['method'] = $method; |
26 | 26 | curl_setopt($handler, CURLOPT_POSTFIELDS, $data); |
27 | 27 | $result = curl_exec($handler); |
28 | 28 | if (curl_errno($handler)) { |
29 | - logger::write(curl_error($handler),loggerTypes::WARNING); |
|
29 | + logger::write(curl_error($handler), loggerTypes::WARNING); |
|
30 | 30 | } |
31 | 31 | if ($info['token'] != settings::$token) { |
32 | 32 | curl_close($handler); |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true); |
43 | 43 | curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
44 | 44 | } |
45 | - else{ |
|
45 | + else { |
|
46 | 46 | $token = settings::$token; |
47 | - if (!isset(self::$curl_handler)){ |
|
47 | + if (!isset(self::$curl_handler)) { |
|
48 | 48 | self::$curl_handler = curl_init(settings::$base_url."/bot$token/"); |
49 | 49 | curl_setopt(self::$curl_handler, CURLOPT_RETURNTRANSFER, true); |
50 | 50 | curl_setopt(self::$curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
@@ -60,22 +60,22 @@ discard block |
||
60 | 60 | ]; |
61 | 61 | } |
62 | 62 | |
63 | - private static function setTimeout(array &$data , CurlHandle $curl_handler,string $method): void { |
|
63 | + private static function setTimeout(array &$data, CurlHandle $curl_handler, string $method): void { |
|
64 | 64 | if (isset($data['forgot'])) { |
65 | 65 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time); |
66 | 66 | unset($data['forgot']); |
67 | 67 | } |
68 | - elseif ($method === 'getUpdates' || $method === 'setWebhook'){ |
|
68 | + elseif ($method === 'getUpdates' || $method === 'setWebhook') { |
|
69 | 69 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000); |
70 | 70 | } |
71 | - else{ |
|
71 | + else { |
|
72 | 72 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$base_timeout); |
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | 76 | private static function setData(array &$data): void { |
77 | - foreach ($data as &$value){ |
|
78 | - if (is_array($value) || (is_object($value) && !is_a($value,'CURLFile'))){ |
|
77 | + foreach ($data as &$value) { |
|
78 | + if (is_array($value) || (is_object($value) && !is_a($value, 'CURLFile'))) { |
|
79 | 79 | $value = json_encode($value); |
80 | 80 | } |
81 | 81 | } |
@@ -480,95 +480,95 @@ discard block |
||
480 | 480 | ]; |
481 | 481 | |
482 | 482 | private const METHODS_KEYS = [ |
483 | - 'getUpdates' => ['offset','limit','timeout','allowed_updates','token','return_array','forgot','answer'], |
|
484 | - 'setWebhook' => ['url','certificate','ip_address','max_connections','allowed_updates','drop_pending_updates','secret_token','token','return_array','forgot','answer'], |
|
485 | - 'deleteWebhook' => ['drop_pending_updates','token','return_array','forgot','answer'], |
|
486 | - 'getWebhookInfo' => ['token','return_array','forgot','answer'], |
|
487 | - 'getMe' => ['token','return_array','forgot','answer'], |
|
488 | - 'logOut' => ['token','return_array','forgot','answer'], |
|
489 | - 'close' => ['token','return_array','forgot','answer'], |
|
490 | - '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'], |
|
491 | - 'forwardMessage' => ['chat_id','from_chat_id','disable_notification','protect_content','message_id','token','return_array','forgot','answer'], |
|
492 | - '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'], |
|
493 | - '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'], |
|
494 | - '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'], |
|
495 | - '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'], |
|
496 | - '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'], |
|
497 | - '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'], |
|
498 | - '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'], |
|
499 | - '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'], |
|
500 | - 'sendMediaGroup' => ['media','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','token','return_array','forgot','answer'], |
|
501 | - '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'], |
|
502 | - 'editMessageLiveLocation' => ['latitude','longitude','chat_id','message_id','inline_message_id','horizontal_accuracy','heading','proximity_alert_radius','reply_markup','token','return_array','forgot','answer'], |
|
503 | - 'stopMessageLiveLocation' => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
504 | - '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'], |
|
505 | - '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'], |
|
506 | - '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'], |
|
507 | - 'sendDice' => ['chat_id','emoji','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
508 | - 'sendChatAction' => ['chat_id','action','token','return_array','forgot','answer'], |
|
509 | - 'getUserProfilePhotos' => ['user_id','offset','limit','token','return_array','forgot','answer'], |
|
510 | - 'getFile' => ['file_id','token','return_array','forgot','answer'], |
|
511 | - 'banChatMember' => ['chat_id','user_id','until_date','revoke_messages','token','return_array','forgot','answer'], |
|
512 | - 'unbanChatMember' => ['chat_id','user_id','only_if_banned','token','return_array','forgot','answer'], |
|
513 | - 'restrictChatMember' => ['permissions','chat_id','user_id','until_date','token','return_array','forgot','answer'], |
|
514 | - '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'], |
|
515 | - 'setChatAdministratorCustomTitle' => ['custom_title','chat_id','user_id','token','return_array','forgot','answer'], |
|
516 | - 'banChatSenderChat' => ['sender_chat_id','chat_id','token','return_array','forgot','answer'], |
|
517 | - 'unbanChatSenderChat' => ['sender_chat_id','chat_id','token','return_array','forgot','answer'], |
|
518 | - 'setChatPermissions' => ['permissions','chat_id','token','return_array','forgot','answer'], |
|
519 | - 'exportChatInviteLink' => ['chat_id','token','return_array','forgot','answer'], |
|
520 | - 'createChatInviteLink' => ['chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'], |
|
521 | - 'editChatInviteLink' => ['invite_link','chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'], |
|
522 | - 'revokeChatInviteLink' => ['invite_link','chat_id','token','return_array','forgot','answer'], |
|
523 | - 'approveChatJoinRequest' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
524 | - 'declineChatJoinRequest' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
525 | - 'setChatPhoto' => ['photo','chat_id','token','return_array','forgot','answer'], |
|
526 | - 'deleteChatPhoto' => ['chat_id','token','return_array','forgot','answer'], |
|
527 | - 'setChatTitle' => ['title','chat_id','token','return_array','forgot','answer'], |
|
528 | - 'setChatDescription' => ['chat_id','description','token','return_array','forgot','answer'], |
|
529 | - 'pinChatMessage' => ['message_id','chat_id','disable_notification','token','return_array','forgot','answer'], |
|
530 | - 'unpinChatMessage' => ['chat_id','message_id','token','return_array','forgot','answer'], |
|
531 | - 'unpinAllChatMessages' => ['chat_id','token','return_array','forgot','answer'], |
|
532 | - 'leaveChat' => ['chat_id','token','return_array','forgot','answer'], |
|
533 | - 'getChat' => ['chat_id','token','return_array','forgot','answer'], |
|
534 | - 'getChatAdministrators' => ['chat_id','token','return_array','forgot','answer'], |
|
535 | - 'getChatMemberCount' => ['chat_id','token','return_array','forgot','answer'], |
|
536 | - 'getChatMember' => ['chat_id','user_id','token','return_array','forgot','answer'], |
|
537 | - 'setChatStickerSet' => ['sticker_set_name','chat_id','token','return_array','forgot','answer'], |
|
538 | - 'deleteChatStickerSet' => ['chat_id','token','return_array','forgot','answer'], |
|
539 | - 'answerCallbackQuery' => ['callback_query_id','text','show_alert','url','cache_time','token','return_array','forgot','answer'], |
|
540 | - 'setMyCommands' => ['commands','scope','language_code','token','return_array','forgot','answer'], |
|
541 | - 'deleteMyCommands' => ['scope','language_code','token','return_array','forgot','answer'], |
|
542 | - 'getMyCommands' => ['scope','language_code','token','return_array','forgot','answer'], |
|
543 | - 'setChatMenuButton' => ['chat_id','menu_button','token','return_array','forgot','answer'], |
|
544 | - 'getChatMenuButton' => ['chat_id','token','return_array','forgot','answer'], |
|
545 | - 'setMyDefaultAdministratorRights' => ['rights','for_channels','token','return_array','forgot','answer'], |
|
546 | - 'getMyDefaultAdministratorRights' => ['for_channels','token','return_array','forgot','answer'], |
|
547 | - 'editMessageText' => ['text','chat_id','message_id','inline_message_id','parse_mode','entities','disable_web_page_preview','reply_markup','token','return_array','forgot','answer'], |
|
548 | - 'editMessageCaption' => ['chat_id','message_id','inline_message_id','caption','parse_mode','caption_entities','reply_markup','token','return_array','forgot','answer'], |
|
549 | - 'editMessageMedia' => ['media','chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
550 | - 'editMessageReplyMarkup' => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'], |
|
551 | - 'stopPoll' => ['chat_id','message_id','reply_markup','token','return_array','forgot','answer'], |
|
552 | - 'deleteMessage' => ['chat_id','message_id','token','return_array','forgot','answer'], |
|
553 | - 'sendSticker' => ['sticker','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'], |
|
554 | - 'getStickerSet' => ['name','token','return_array','forgot','answer'], |
|
483 | + 'getUpdates' => ['offset', 'limit', 'timeout', 'allowed_updates', 'token', 'return_array', 'forgot', 'answer'], |
|
484 | + 'setWebhook' => ['url', 'certificate', 'ip_address', 'max_connections', 'allowed_updates', 'drop_pending_updates', 'secret_token', 'token', 'return_array', 'forgot', 'answer'], |
|
485 | + 'deleteWebhook' => ['drop_pending_updates', 'token', 'return_array', 'forgot', 'answer'], |
|
486 | + 'getWebhookInfo' => ['token', 'return_array', 'forgot', 'answer'], |
|
487 | + 'getMe' => ['token', 'return_array', 'forgot', 'answer'], |
|
488 | + 'logOut' => ['token', 'return_array', 'forgot', 'answer'], |
|
489 | + 'close' => ['token', 'return_array', 'forgot', 'answer'], |
|
490 | + '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'], |
|
491 | + 'forwardMessage' => ['chat_id', 'from_chat_id', 'disable_notification', 'protect_content', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
492 | + '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'], |
|
493 | + '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'], |
|
494 | + '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'], |
|
495 | + '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'], |
|
496 | + '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'], |
|
497 | + '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'], |
|
498 | + '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'], |
|
499 | + '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'], |
|
500 | + 'sendMediaGroup' => ['media', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'token', 'return_array', 'forgot', 'answer'], |
|
501 | + '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'], |
|
502 | + 'editMessageLiveLocation' => ['latitude', 'longitude', 'chat_id', 'message_id', 'inline_message_id', 'horizontal_accuracy', 'heading', 'proximity_alert_radius', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
503 | + 'stopMessageLiveLocation' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
504 | + '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'], |
|
505 | + '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'], |
|
506 | + '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'], |
|
507 | + 'sendDice' => ['chat_id', 'emoji', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
508 | + 'sendChatAction' => ['chat_id', 'action', 'token', 'return_array', 'forgot', 'answer'], |
|
509 | + 'getUserProfilePhotos' => ['user_id', 'offset', 'limit', 'token', 'return_array', 'forgot', 'answer'], |
|
510 | + 'getFile' => ['file_id', 'token', 'return_array', 'forgot', 'answer'], |
|
511 | + 'banChatMember' => ['chat_id', 'user_id', 'until_date', 'revoke_messages', 'token', 'return_array', 'forgot', 'answer'], |
|
512 | + 'unbanChatMember' => ['chat_id', 'user_id', 'only_if_banned', 'token', 'return_array', 'forgot', 'answer'], |
|
513 | + 'restrictChatMember' => ['permissions', 'chat_id', 'user_id', 'until_date', 'token', 'return_array', 'forgot', 'answer'], |
|
514 | + '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'], |
|
515 | + 'setChatAdministratorCustomTitle' => ['custom_title', 'chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
516 | + 'banChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
517 | + 'unbanChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
518 | + 'setChatPermissions' => ['permissions', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
519 | + 'exportChatInviteLink' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
520 | + 'createChatInviteLink' => ['chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'], |
|
521 | + 'editChatInviteLink' => ['invite_link', 'chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'], |
|
522 | + 'revokeChatInviteLink' => ['invite_link', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
523 | + 'approveChatJoinRequest' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
524 | + 'declineChatJoinRequest' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
525 | + 'setChatPhoto' => ['photo', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
526 | + 'deleteChatPhoto' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
527 | + 'setChatTitle' => ['title', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
528 | + 'setChatDescription' => ['chat_id', 'description', 'token', 'return_array', 'forgot', 'answer'], |
|
529 | + 'pinChatMessage' => ['message_id', 'chat_id', 'disable_notification', 'token', 'return_array', 'forgot', 'answer'], |
|
530 | + 'unpinChatMessage' => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
531 | + 'unpinAllChatMessages' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
532 | + 'leaveChat' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
533 | + 'getChat' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
534 | + 'getChatAdministrators' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
535 | + 'getChatMemberCount' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
536 | + 'getChatMember' => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
537 | + 'setChatStickerSet' => ['sticker_set_name', 'chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
538 | + 'deleteChatStickerSet' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
539 | + 'answerCallbackQuery' => ['callback_query_id', 'text', 'show_alert', 'url', 'cache_time', 'token', 'return_array', 'forgot', 'answer'], |
|
540 | + 'setMyCommands' => ['commands', 'scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
541 | + 'deleteMyCommands' => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
542 | + 'getMyCommands' => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'], |
|
543 | + 'setChatMenuButton' => ['chat_id', 'menu_button', 'token', 'return_array', 'forgot', 'answer'], |
|
544 | + 'getChatMenuButton' => ['chat_id', 'token', 'return_array', 'forgot', 'answer'], |
|
545 | + 'setMyDefaultAdministratorRights' => ['rights', 'for_channels', 'token', 'return_array', 'forgot', 'answer'], |
|
546 | + 'getMyDefaultAdministratorRights' => ['for_channels', 'token', 'return_array', 'forgot', 'answer'], |
|
547 | + 'editMessageText' => ['text', 'chat_id', 'message_id', 'inline_message_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
548 | + 'editMessageCaption' => ['chat_id', 'message_id', 'inline_message_id', 'caption', 'parse_mode', 'caption_entities', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
549 | + 'editMessageMedia' => ['media', 'chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
550 | + 'editMessageReplyMarkup' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
551 | + 'stopPoll' => ['chat_id', 'message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
552 | + 'deleteMessage' => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
553 | + 'sendSticker' => ['sticker', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'], |
|
554 | + 'getStickerSet' => ['name', 'token', 'return_array', 'forgot', 'answer'], |
|
555 | 555 | 'getCustomEmojiStickers' => ['custom_emoji_ids', 'token', 'return_array', 'forgot', 'answer'], |
556 | - 'uploadStickerFile' => ['png_sticker','user_id','token','return_array','forgot','answer'], |
|
557 | - 'createNewStickerSet' => ['name','title','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','sticker_type','contains_masks','mask_position','token','return_array','forgot','answer'], |
|
558 | - 'addStickerToSet' => ['name','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','mask_position','token','return_array','forgot','answer'], |
|
559 | - 'setStickerPositionInSet' => ['sticker','position','token','return_array','forgot','answer'], |
|
560 | - 'deleteStickerFromSet' => ['sticker','token','return_array','forgot','answer'], |
|
561 | - 'setStickerSetThumb' => ['name','user_id','thumb','token','return_array','forgot','answer'], |
|
562 | - 'answerInlineQuery' => ['results','inline_query_id','cache_time','is_personal','next_offset','switch_pm_text','switch_pm_parameter','token','return_array','forgot','answer'], |
|
563 | - 'answerWebAppQuery' => ['web_app_query_id','result','token','return_array','forgot','answer'], |
|
564 | - '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'], |
|
565 | - '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'], |
|
566 | - 'answerShippingQuery' => ['ok','shipping_query_id','shipping_options','error_message','token','return_array','forgot','answer'], |
|
567 | - 'answerPreCheckoutQuery' => ['ok','pre_checkout_query_id','error_message','token','return_array','forgot','answer'], |
|
568 | - 'setPassportDataErrors' => ['errors','user_id','token','return_array','forgot','answer'], |
|
569 | - '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'], |
|
570 | - 'setGameScore' => ['score','user_id','force','disable_edit_message','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'], |
|
571 | - 'getGameHighScores' => ['user_id','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'], |
|
556 | + 'uploadStickerFile' => ['png_sticker', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
557 | + 'createNewStickerSet' => ['name', 'title', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'sticker_type', 'contains_masks', 'mask_position', 'token', 'return_array', 'forgot', 'answer'], |
|
558 | + 'addStickerToSet' => ['name', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'mask_position', 'token', 'return_array', 'forgot', 'answer'], |
|
559 | + 'setStickerPositionInSet' => ['sticker', 'position', 'token', 'return_array', 'forgot', 'answer'], |
|
560 | + 'deleteStickerFromSet' => ['sticker', 'token', 'return_array', 'forgot', 'answer'], |
|
561 | + 'setStickerSetThumb' => ['name', 'user_id', 'thumb', 'token', 'return_array', 'forgot', 'answer'], |
|
562 | + 'answerInlineQuery' => ['results', 'inline_query_id', 'cache_time', 'is_personal', 'next_offset', 'switch_pm_text', 'switch_pm_parameter', 'token', 'return_array', 'forgot', 'answer'], |
|
563 | + 'answerWebAppQuery' => ['web_app_query_id', 'result', 'token', 'return_array', 'forgot', 'answer'], |
|
564 | + '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'], |
|
565 | + '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'], |
|
566 | + 'answerShippingQuery' => ['ok', 'shipping_query_id', 'shipping_options', 'error_message', 'token', 'return_array', 'forgot', 'answer'], |
|
567 | + 'answerPreCheckoutQuery' => ['ok', 'pre_checkout_query_id', 'error_message', 'token', 'return_array', 'forgot', 'answer'], |
|
568 | + 'setPassportDataErrors' => ['errors', 'user_id', 'token', 'return_array', 'forgot', 'answer'], |
|
569 | + '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'], |
|
570 | + 'setGameScore' => ['score', 'user_id', 'force', 'disable_edit_message', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
571 | + 'getGameHighScores' => ['user_id', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'], |
|
572 | 572 | 'getForumTopicIconStickers' => ['token', 'return_array', 'forgot', 'answer'], |
573 | 573 | 'createForumTopic' => ['chat_id', 'name', 'icon_color', 'icon_custom_emoji_id', 'token', 'return_array', 'forgot', 'answer'], |
574 | 574 | 'editForumTopic' => ['chat_id', 'message_thread_id', 'name', 'icon_custom_emoji_id', 'token', 'return_array', 'forgot', 'answer'], |
@@ -604,8 +604,8 @@ discard block |
||
604 | 604 | 'logOut' => [], |
605 | 605 | 'close' => [], |
606 | 606 | 'sendMessage' => ['chat_id'], |
607 | - 'forwardMessage' => ['from_chat_id','message_id'], |
|
608 | - 'copyMessage' => ['from_chat_id','message_id'], |
|
607 | + 'forwardMessage' => ['from_chat_id', 'message_id'], |
|
608 | + 'copyMessage' => ['from_chat_id', 'message_id'], |
|
609 | 609 | 'sendPhoto' => ['chat_id'], |
610 | 610 | 'sendAudio' => ['chat_id'], |
611 | 611 | 'sendDocument' => ['chat_id'], |
@@ -621,15 +621,15 @@ discard block |
||
621 | 621 | 'sendContact' => ['chat_id'], |
622 | 622 | 'sendPoll' => ['chat_id'], |
623 | 623 | 'sendDice' => ['chat_id'], |
624 | - 'sendChatAction' => ['chat_id','action'], |
|
624 | + 'sendChatAction' => ['chat_id', 'action'], |
|
625 | 625 | 'getUserProfilePhotos' => ['user_id'], |
626 | 626 | 'getFile' => ['file_id'], |
627 | - 'banChatMember' => ['chat_id','user_id'], |
|
628 | - 'kickChatMember' => ['chat_id','user_id'], |
|
629 | - 'unbanChatMember' => ['chat_id','user_id'], |
|
630 | - 'restrictChatMember' => ['chat_id','user_id'], |
|
631 | - 'promoteChatMember' => ['chat_id','user_id'], |
|
632 | - 'setChatAdministratorCustomTitle' => ['chat_id','user_id'], |
|
627 | + 'banChatMember' => ['chat_id', 'user_id'], |
|
628 | + 'kickChatMember' => ['chat_id', 'user_id'], |
|
629 | + 'unbanChatMember' => ['chat_id', 'user_id'], |
|
630 | + 'restrictChatMember' => ['chat_id', 'user_id'], |
|
631 | + 'promoteChatMember' => ['chat_id', 'user_id'], |
|
632 | + 'setChatAdministratorCustomTitle' => ['chat_id', 'user_id'], |
|
633 | 633 | 'banChatSenderChat' => ['chat_id'], |
634 | 634 | 'unbanChatSenderChat' => ['chat_id'], |
635 | 635 | 'setChatPermissions' => ['chat_id'], |
@@ -637,8 +637,8 @@ discard block |
||
637 | 637 | 'createChatInviteLink' => ['chat_id'], |
638 | 638 | 'editChatInviteLink' => ['chat_id'], |
639 | 639 | 'revokeChatInviteLink' => ['chat_id'], |
640 | - 'approveChatJoinRequest' => ['chat_id','user_id'], |
|
641 | - 'declineChatJoinRequest' => ['chat_id','user_id'], |
|
640 | + 'approveChatJoinRequest' => ['chat_id', 'user_id'], |
|
641 | + 'declineChatJoinRequest' => ['chat_id', 'user_id'], |
|
642 | 642 | 'setChatPhoto' => ['chat_id'], |
643 | 643 | 'deleteChatPhoto' => ['chat_id'], |
644 | 644 | 'setChatTitle' => ['chat_id'], |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | 'getChat' => ['chat_id'], |
651 | 651 | 'getChatAdministrators' => ['chat_id'], |
652 | 652 | 'getChatMembersCount' => ['chat_id'], |
653 | - 'getChatMember' => ['chat_id','user_id'], |
|
653 | + 'getChatMember' => ['chat_id', 'user_id'], |
|
654 | 654 | 'setChatStickerSet' => ['chat_id'], |
655 | 655 | 'deleteChatStickerSet' => ['chat_id'], |
656 | 656 | 'answerCallbackQuery' => ['callback_query_id'], |
@@ -661,12 +661,12 @@ discard block |
||
661 | 661 | 'getChatMenuButton' => [], |
662 | 662 | 'setMyDefaultAdministratorRights' => [], |
663 | 663 | 'getMyDefaultAdministratorRights' => [], |
664 | - 'editMessageText' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
665 | - 'editMessageCaption' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
666 | - 'editMessageMedia' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
667 | - 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
668 | - 'stopPoll' => ['chat_id','message_id'], |
|
669 | - 'deleteMessage' => ['chat_id','message_id'], |
|
664 | + 'editMessageText' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
665 | + 'editMessageCaption' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
666 | + 'editMessageMedia' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
667 | + 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
668 | + 'stopPoll' => ['chat_id', 'message_id'], |
|
669 | + 'deleteMessage' => ['chat_id', 'message_id'], |
|
670 | 670 | 'sendSticker' => ['chat_id'], |
671 | 671 | 'getStickerSet' => [], |
672 | 672 | 'uploadStickerFile' => ['user_id'], |
@@ -682,8 +682,8 @@ discard block |
||
682 | 682 | 'answerPreCheckoutQuery' => ['pre_checkout_query_id'], |
683 | 683 | 'setPassportDataErrors' => ['user_id'], |
684 | 684 | 'sendGame' => ['chat_id'], |
685 | - 'setGameScore' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
686 | - 'getGameHighScores' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']] |
|
685 | + 'setGameScore' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
686 | + 'getGameHighScores' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']] |
|
687 | 687 | ]; |
688 | 688 | |
689 | 689 | private const METHODS_RETURN = [ |
@@ -737,25 +737,25 @@ discard block |
||
737 | 737 | 'getGameHighScores' => ['BPT\types\gameHighScore'] |
738 | 738 | ]; |
739 | 739 | |
740 | - public static function __callStatic (string $name, array $arguments) { |
|
740 | + public static function __callStatic(string $name, array $arguments) { |
|
741 | 741 | if ($action = self::methodAction($name)) { |
742 | 742 | self::checkArguments($arguments); |
743 | - self::keysName($action,$arguments); |
|
744 | - self::readyFile($action,$arguments); |
|
745 | - self::setDefaults($action,$arguments); |
|
743 | + self::keysName($action, $arguments); |
|
744 | + self::readyFile($action, $arguments); |
|
745 | + self::setDefaults($action, $arguments); |
|
746 | 746 | if (isset($arguments['answer'])) { |
747 | - return answer::init($action,$arguments); |
|
747 | + return answer::init($action, $arguments); |
|
748 | 748 | } |
749 | 749 | else { |
750 | - $result = curl::init($action,$arguments); |
|
750 | + $result = curl::init($action, $arguments); |
|
751 | 751 | if (is_object($result)) { |
752 | - return self::processResponse($action,$result); |
|
752 | + return self::processResponse($action, $result); |
|
753 | 753 | } |
754 | 754 | return false; |
755 | 755 | } |
756 | 756 | } |
757 | 757 | else { |
758 | - logger::write("$name method is not supported",loggerTypes::ERROR); |
|
758 | + logger::write("$name method is not supported", loggerTypes::ERROR); |
|
759 | 759 | throw new bptException('METHOD_NOT_FOUND'); |
760 | 760 | } |
761 | 761 | } |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | } |
767 | 767 | } |
768 | 768 | |
769 | - private static function keysName (string $name, array &$arguments): void { |
|
769 | + private static function keysName(string $name, array &$arguments): void { |
|
770 | 770 | foreach ($arguments as $key => $argument) { |
771 | 771 | if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) { |
772 | 772 | $arguments[self::METHODS_KEYS[$name][$key]] = $argument; |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | } |
776 | 776 | } |
777 | 777 | |
778 | - private static function methodAction(string $name): string|false { |
|
778 | + private static function methodAction(string $name): string | false { |
|
779 | 779 | return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false; |
780 | 780 | } |
781 | 781 | |
@@ -796,11 +796,11 @@ discard block |
||
796 | 796 | } |
797 | 797 | } |
798 | 798 | |
799 | - private static function methodFile(string $name): array|false { |
|
799 | + private static function methodFile(string $name): array | false { |
|
800 | 800 | return self::METHODS_WITH_FILE[$name] ?? false; |
801 | 801 | } |
802 | 802 | |
803 | - private static function methodReturn(string $name,stdClass $response) { |
|
803 | + private static function methodReturn(string $name, stdClass $response) { |
|
804 | 804 | if (isset(self::METHODS_RETURN[$name])) { |
805 | 805 | $return = self::METHODS_RETURN[$name]; |
806 | 806 | if (is_array($return)) { |
@@ -823,13 +823,13 @@ discard block |
||
823 | 823 | $defaults = self::METHODS_EXTRA_DEFAULTS[$name]; |
824 | 824 | foreach ($defaults as $key => $default) { |
825 | 825 | if (is_numeric($key)) { |
826 | - if (!isset($arguments[$default])){ |
|
826 | + if (!isset($arguments[$default])) { |
|
827 | 827 | $arguments[$default] = self::catchFields($default); |
828 | 828 | } |
829 | 829 | } |
830 | 830 | elseif (isset(BPT::$update->$key) || $key === 'other') { |
831 | 831 | foreach ($default as $def) { |
832 | - if (!isset($arguments[$def])){ |
|
832 | + if (!isset($arguments[$def])) { |
|
833 | 833 | $arguments[$def] = self::catchFields($def); |
834 | 834 | } |
835 | 835 | } |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | if ($response->ok) { |
843 | 843 | self::$status = true; |
844 | 844 | self::$pure_response = $response; |
845 | - return self::methodReturn($name,$response); |
|
845 | + return self::methodReturn($name, $response); |
|
846 | 846 | } |
847 | 847 | else { |
848 | 848 | self::$status = false; |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | * |
859 | 859 | * @return int|string|bool |
860 | 860 | */ |
861 | - public static function catchFields (string $field): int|string|bool { |
|
861 | + public static function catchFields(string $field): int | string | bool { |
|
862 | 862 | switch ($field) { |
863 | 863 | case fields::CHAT_ID : |
864 | 864 | case fields::FROM_CHAT_ID : |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | default => false |
995 | 995 | }; |
996 | 996 | case fields::URL : |
997 | - return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
997 | + return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
998 | 998 | default: |
999 | 999 | return false; |
1000 | 1000 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * telegram class , Adding normal method call to request class and a simple name for being easy to call |
9 | 9 | */ |
10 | 10 | class telegram extends request { |
11 | - public function __call (string $name, array $arguments) { |
|
11 | + public function __call(string $name, array $arguments) { |
|
12 | 12 | return request::$name(...$arguments); |
13 | 13 | } |
14 | 14 | |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return bool |
28 | 28 | */ |
29 | - public static function downloadFile (string|null $destination = null, string|null $file_id = null): bool { |
|
29 | + public static function downloadFile(string | null $destination = null, string | null $file_id = null): bool { |
|
30 | 30 | $file = telegram::getFile($file_id); |
31 | 31 | if (isset($file->file_path)) { |
32 | - $file_path = settings::$down_url . 'bot' . settings::$token . '/' . $file->file_path; |
|
32 | + $file_path = settings::$down_url.'bot'.settings::$token.'/'.$file->file_path; |
|
33 | 33 | return tools::downloadFile($file_path, $destination); |
34 | 34 | } |
35 | 35 | else { |