Passed
Push — main ( e4603c...5f3e0b )
by Miaad
01:47
created
src/api/request/answer.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,44 +17,44 @@
 block discarded – undo
17 17
     /**
18 18
      * @internal Only for BPT self usage , Don't use it in your source!
19 19
      */
20
-    public static function init(string $method,array $data): bool {
20
+    public static function init(string $method, array $data): bool {
21 21
         self::checkAnswered();
22 22
         self::checkWebhook();
23 23
         self::sieveData($data);
24 24
         self::$is_answered = true;
25 25
         $data['method'] = $method;
26 26
         $payload = json_encode($data);
27
-        header('Content-Type: application/json;Content-Length: ' . strlen($payload));
27
+        header('Content-Type: application/json;Content-Length: '.strlen($payload));
28 28
         echo $payload;
29 29
         return true;
30 30
     }
31 31
 
32 32
     private static function checkAnswered(): void {
33 33
         if (self::$is_answered) {
34
-            logger::write('You can use answer mode only once for each webhook update , You already did it!',loggerTypes::ERROR);
34
+            logger::write('You can use answer mode only once for each webhook update , You already did it!', loggerTypes::ERROR);
35 35
             throw new bptException('ANSWER_MODE_USED');
36 36
         }
37 37
     }
38 38
 
39 39
     private static function checkWebhook(): void {
40
-        if(settings::$receiver === receiver::GETUPDATES) {
41
-            logger::write('Answer mode only work when receiver is webhook',loggerTypes::ERROR);
40
+        if (settings::$receiver === receiver::GETUPDATES) {
41
+            logger::write('Answer mode only work when receiver is webhook', loggerTypes::ERROR);
42 42
             throw new bptException('ANSWER_MODE_GETUPDATES');
43 43
         }
44
-        elseif(settings::$multi) {
45
-            logger::write('You can not use answer mode when multi setting is on',loggerTypes::ERROR);
44
+        elseif (settings::$multi) {
45
+            logger::write('You can not use answer mode when multi setting is on', loggerTypes::ERROR);
46 46
             throw new bptException('ANSWER_MODE_MULTI');
47 47
         }
48 48
     }
49 49
 
50 50
     private static function sieveData(array &$data): void {
51
-        unset($data['token'],$data['forgot'],$data['return_array']);
51
+        unset($data['token'], $data['forgot'], $data['return_array']);
52 52
 
53
-        foreach ($data as $key=>&$value){
54
-            if (!isset($value)){
53
+        foreach ($data as $key=>&$value) {
54
+            if (!isset($value)) {
55 55
                 unset($data[$key]);
56 56
             }
57
-            elseif (is_array($value) || is_object($value)){
57
+            elseif (is_array($value) || is_object($value)) {
58 58
                 $value = json_encode($value);
59 59
             }
60 60
         }
Please login to merge, or discard this patch.
src/api/request.php 2 patches
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -450,94 +450,94 @@  discard block
 block discarded – undo
450 450
     ];
451 451
 
452 452
     private const METHODS_KEYS = [
453
-        'getUpdates'                      => ['offset','limit','timeout','allowed_updates','token','return_array','forgot','answer'],
454
-        'setWebhook'                      => ['url','certificate','ip_address','max_connections','allowed_updates','drop_pending_updates','secret_token','token','return_array','forgot','answer'],
455
-        'deleteWebhook'                   => ['drop_pending_updates','token','return_array','forgot','answer'],
456
-        'getWebhookInfo'                  => ['token','return_array','forgot','answer'],
457
-        'getMe'                           => ['token','return_array','forgot','answer'],
458
-        'logOut'                          => ['token','return_array','forgot','answer'],
459
-        'close'                           => ['token','return_array','forgot','answer'],
460
-        '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'],
461
-        'forwardMessage'                  => ['chat_id','from_chat_id','disable_notification','protect_content','message_id','token','return_array','forgot','answer'],
462
-        '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'],
463
-        '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'],
464
-        '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'],
465
-        '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'],
466
-        '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'],
467
-        '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'],
468
-        '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'],
469
-        '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'],
470
-        'sendMediaGroup'                  => ['media','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','token','return_array','forgot','answer'],
471
-        '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'],
472
-        'editMessageLiveLocation'         => ['latitude','longitude','chat_id','message_id','inline_message_id','horizontal_accuracy','heading','proximity_alert_radius','reply_markup','token','return_array','forgot','answer'],
473
-        'stopMessageLiveLocation'         => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'],
474
-        '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'],
475
-        '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'],
476
-        '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'],
477
-        'sendDice'                        => ['chat_id','emoji','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
478
-        'sendChatAction'                  => ['chat_id','action','token','return_array','forgot','answer'],
479
-        'getUserProfilePhotos'            => ['user_id','offset','limit','token','return_array','forgot','answer'],
480
-        'getFile'                         => ['file_id','token','return_array','forgot','answer'],
481
-        'banChatMember'                   => ['chat_id','user_id','until_date','revoke_messages','token','return_array','forgot','answer'],
482
-        'unbanChatMember'                 => ['chat_id','user_id','only_if_banned','token','return_array','forgot','answer'],
483
-        'restrictChatMember'              => ['permissions','chat_id','user_id','until_date','token','return_array','forgot','answer'],
484
-        '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'],
485
-        'setChatAdministratorCustomTitle' => ['custom_title','chat_id','user_id','token','return_array','forgot','answer'],
486
-        'banChatSenderChat'               => ['sender_chat_id','chat_id','token','return_array','forgot','answer'],
487
-        'unbanChatSenderChat'             => ['sender_chat_id','chat_id','token','return_array','forgot','answer'],
488
-        'setChatPermissions'              => ['permissions','chat_id','token','return_array','forgot','answer'],
489
-        'exportChatInviteLink'            => ['chat_id','token','return_array','forgot','answer'],
490
-        'createChatInviteLink'            => ['chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'],
491
-        'editChatInviteLink'              => ['invite_link','chat_id','name','expire_date','member_limit','creates_join_request','token','return_array','forgot','answer'],
492
-        'revokeChatInviteLink'            => ['invite_link','chat_id','token','return_array','forgot','answer'],
493
-        'approveChatJoinRequest'          => ['chat_id','user_id','token','return_array','forgot','answer'],
494
-        'declineChatJoinRequest'          => ['chat_id','user_id','token','return_array','forgot','answer'],
495
-        'setChatPhoto'                    => ['photo','chat_id','token','return_array','forgot','answer'],
496
-        'deleteChatPhoto'                 => ['chat_id','token','return_array','forgot','answer'],
497
-        'setChatTitle'                    => ['title','chat_id','token','return_array','forgot','answer'],
498
-        'setChatDescription'              => ['chat_id','description','token','return_array','forgot','answer'],
499
-        'pinChatMessage'                  => ['message_id','chat_id','disable_notification','token','return_array','forgot','answer'],
500
-        'unpinChatMessage'                => ['chat_id','message_id','token','return_array','forgot','answer'],
501
-        'unpinAllChatMessages'            => ['chat_id','token','return_array','forgot','answer'],
502
-        'leaveChat'                       => ['chat_id','token','return_array','forgot','answer'],
503
-        'getChat'                         => ['chat_id','token','return_array','forgot','answer'],
504
-        'getChatAdministrators'           => ['chat_id','token','return_array','forgot','answer'],
505
-        'getChatMemberCount'              => ['chat_id','token','return_array','forgot','answer'],
506
-        'getChatMember'                   => ['chat_id','user_id','token','return_array','forgot','answer'],
507
-        'setChatStickerSet'               => ['sticker_set_name','chat_id','token','return_array','forgot','answer'],
508
-        'deleteChatStickerSet'            => ['chat_id','token','return_array','forgot','answer'],
509
-        'answerCallbackQuery'             => ['callback_query_id','text','show_alert','url','cache_time','token','return_array','forgot','answer'],
510
-        'setMyCommands'                   => ['commands','scope','language_code','token','return_array','forgot','answer'],
511
-        'deleteMyCommands'                => ['scope','language_code','token','return_array','forgot','answer'],
512
-        'getMyCommands'                   => ['scope','language_code','token','return_array','forgot','answer'],
513
-        'setChatMenuButton'               => ['chat_id','menu_button','token','return_array','forgot','answer'],
514
-        'getChatMenuButton'               => ['chat_id','token','return_array','forgot','answer'],
515
-        'setMyDefaultAdministratorRights' => ['rights','for_channels','token','return_array','forgot','answer'],
516
-        'getMyDefaultAdministratorRights' => ['for_channels','token','return_array','forgot','answer'],
517
-        'editMessageText'                 => ['text','chat_id','message_id','inline_message_id','parse_mode','entities','disable_web_page_preview','reply_markup','token','return_array','forgot','answer'],
518
-        'editMessageCaption'              => ['chat_id','message_id','inline_message_id','caption','parse_mode','caption_entities','reply_markup','token','return_array','forgot','answer'],
519
-        'editMessageMedia'                => ['media','chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'],
520
-        'editMessageReplyMarkup'          => ['chat_id','message_id','inline_message_id','reply_markup','token','return_array','forgot','answer'],
521
-        'stopPoll'                        => ['chat_id','message_id','reply_markup','token','return_array','forgot','answer'],
522
-        'deleteMessage'                   => ['chat_id','message_id','token','return_array','forgot','answer'],
523
-        'sendSticker'                     => ['sticker','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','return_array','forgot','answer'],
524
-        'getStickerSet'                   => ['name','token','return_array','forgot','answer'],
525
-        'uploadStickerFile'               => ['png_sticker','user_id','token','return_array','forgot','answer'],
526
-        'createNewStickerSet'             => ['name','title','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','contains_masks','mask_position','token','return_array','forgot','answer'],
527
-        'addStickerToSet'                 => ['name','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','mask_position','token','return_array','forgot','answer'],
528
-        'setStickerPositionInSet'         => ['sticker','position','token','return_array','forgot','answer'],
529
-        'deleteStickerFromSet'            => ['sticker','token','return_array','forgot','answer'],
530
-        'setStickerSetThumb'              => ['name','user_id','thumb','token','return_array','forgot','answer'],
531
-        'answerInlineQuery'               => ['results','inline_query_id','cache_time','is_personal','next_offset','switch_pm_text','switch_pm_parameter','token','return_array','forgot','answer'],
532
-        'answerWebAppQuery'               => ['web_app_query_id','result','token','return_array','forgot','answer'],
533
-        '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'],
534
-        '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'],
535
-        'answerShippingQuery'             => ['ok','shipping_query_id','shipping_options','error_message','token','return_array','forgot','answer'],
536
-        'answerPreCheckoutQuery'          => ['ok','pre_checkout_query_id','error_message','token','return_array','forgot','answer'],
537
-        'setPassportDataErrors'           => ['errors','user_id','token','return_array','forgot','answer'],
538
-        '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'],
539
-        'setGameScore'                    => ['score','user_id','force','disable_edit_message','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'],
540
-        'getGameHighScores'               => ['user_id','chat_id','message_id','inline_message_id','token','return_array','forgot','answer'],
453
+        'getUpdates'                      => ['offset', 'limit', 'timeout', 'allowed_updates', 'token', 'return_array', 'forgot', 'answer'],
454
+        'setWebhook'                      => ['url', 'certificate', 'ip_address', 'max_connections', 'allowed_updates', 'drop_pending_updates', 'secret_token', 'token', 'return_array', 'forgot', 'answer'],
455
+        'deleteWebhook'                   => ['drop_pending_updates', 'token', 'return_array', 'forgot', 'answer'],
456
+        'getWebhookInfo'                  => ['token', 'return_array', 'forgot', 'answer'],
457
+        'getMe'                           => ['token', 'return_array', 'forgot', 'answer'],
458
+        'logOut'                          => ['token', 'return_array', 'forgot', 'answer'],
459
+        'close'                           => ['token', 'return_array', 'forgot', 'answer'],
460
+        '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'],
461
+        'forwardMessage'                  => ['chat_id', 'from_chat_id', 'disable_notification', 'protect_content', 'message_id', 'token', 'return_array', 'forgot', 'answer'],
462
+        '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'],
463
+        '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'],
464
+        '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'],
465
+        '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'],
466
+        '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'],
467
+        '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'],
468
+        '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'],
469
+        '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'],
470
+        'sendMediaGroup'                  => ['media', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'token', 'return_array', 'forgot', 'answer'],
471
+        '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'],
472
+        'editMessageLiveLocation'         => ['latitude', 'longitude', 'chat_id', 'message_id', 'inline_message_id', 'horizontal_accuracy', 'heading', 'proximity_alert_radius', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
473
+        'stopMessageLiveLocation'         => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
474
+        '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'],
475
+        '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'],
476
+        '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'],
477
+        'sendDice'                        => ['chat_id', 'emoji', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
478
+        'sendChatAction'                  => ['chat_id', 'action', 'token', 'return_array', 'forgot', 'answer'],
479
+        'getUserProfilePhotos'            => ['user_id', 'offset', 'limit', 'token', 'return_array', 'forgot', 'answer'],
480
+        'getFile'                         => ['file_id', 'token', 'return_array', 'forgot', 'answer'],
481
+        'banChatMember'                   => ['chat_id', 'user_id', 'until_date', 'revoke_messages', 'token', 'return_array', 'forgot', 'answer'],
482
+        'unbanChatMember'                 => ['chat_id', 'user_id', 'only_if_banned', 'token', 'return_array', 'forgot', 'answer'],
483
+        'restrictChatMember'              => ['permissions', 'chat_id', 'user_id', 'until_date', 'token', 'return_array', 'forgot', 'answer'],
484
+        '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'],
485
+        'setChatAdministratorCustomTitle' => ['custom_title', 'chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
486
+        'banChatSenderChat'               => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
487
+        'unbanChatSenderChat'             => ['sender_chat_id', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
488
+        'setChatPermissions'              => ['permissions', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
489
+        'exportChatInviteLink'            => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
490
+        'createChatInviteLink'            => ['chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'],
491
+        'editChatInviteLink'              => ['invite_link', 'chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'return_array', 'forgot', 'answer'],
492
+        'revokeChatInviteLink'            => ['invite_link', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
493
+        'approveChatJoinRequest'          => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
494
+        'declineChatJoinRequest'          => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
495
+        'setChatPhoto'                    => ['photo', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
496
+        'deleteChatPhoto'                 => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
497
+        'setChatTitle'                    => ['title', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
498
+        'setChatDescription'              => ['chat_id', 'description', 'token', 'return_array', 'forgot', 'answer'],
499
+        'pinChatMessage'                  => ['message_id', 'chat_id', 'disable_notification', 'token', 'return_array', 'forgot', 'answer'],
500
+        'unpinChatMessage'                => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'],
501
+        'unpinAllChatMessages'            => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
502
+        'leaveChat'                       => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
503
+        'getChat'                         => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
504
+        'getChatAdministrators'           => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
505
+        'getChatMemberCount'              => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
506
+        'getChatMember'                   => ['chat_id', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
507
+        'setChatStickerSet'               => ['sticker_set_name', 'chat_id', 'token', 'return_array', 'forgot', 'answer'],
508
+        'deleteChatStickerSet'            => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
509
+        'answerCallbackQuery'             => ['callback_query_id', 'text', 'show_alert', 'url', 'cache_time', 'token', 'return_array', 'forgot', 'answer'],
510
+        'setMyCommands'                   => ['commands', 'scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'],
511
+        'deleteMyCommands'                => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'],
512
+        'getMyCommands'                   => ['scope', 'language_code', 'token', 'return_array', 'forgot', 'answer'],
513
+        'setChatMenuButton'               => ['chat_id', 'menu_button', 'token', 'return_array', 'forgot', 'answer'],
514
+        'getChatMenuButton'               => ['chat_id', 'token', 'return_array', 'forgot', 'answer'],
515
+        'setMyDefaultAdministratorRights' => ['rights', 'for_channels', 'token', 'return_array', 'forgot', 'answer'],
516
+        'getMyDefaultAdministratorRights' => ['for_channels', 'token', 'return_array', 'forgot', 'answer'],
517
+        'editMessageText'                 => ['text', 'chat_id', 'message_id', 'inline_message_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
518
+        'editMessageCaption'              => ['chat_id', 'message_id', 'inline_message_id', 'caption', 'parse_mode', 'caption_entities', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
519
+        'editMessageMedia'                => ['media', 'chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
520
+        'editMessageReplyMarkup'          => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
521
+        'stopPoll'                        => ['chat_id', 'message_id', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
522
+        'deleteMessage'                   => ['chat_id', 'message_id', 'token', 'return_array', 'forgot', 'answer'],
523
+        'sendSticker'                     => ['sticker', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'return_array', 'forgot', 'answer'],
524
+        'getStickerSet'                   => ['name', 'token', 'return_array', 'forgot', 'answer'],
525
+        'uploadStickerFile'               => ['png_sticker', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
526
+        'createNewStickerSet'             => ['name', 'title', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'contains_masks', 'mask_position', 'token', 'return_array', 'forgot', 'answer'],
527
+        'addStickerToSet'                 => ['name', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'mask_position', 'token', 'return_array', 'forgot', 'answer'],
528
+        'setStickerPositionInSet'         => ['sticker', 'position', 'token', 'return_array', 'forgot', 'answer'],
529
+        'deleteStickerFromSet'            => ['sticker', 'token', 'return_array', 'forgot', 'answer'],
530
+        'setStickerSetThumb'              => ['name', 'user_id', 'thumb', 'token', 'return_array', 'forgot', 'answer'],
531
+        'answerInlineQuery'               => ['results', 'inline_query_id', 'cache_time', 'is_personal', 'next_offset', 'switch_pm_text', 'switch_pm_parameter', 'token', 'return_array', 'forgot', 'answer'],
532
+        'answerWebAppQuery'               => ['web_app_query_id', 'result', 'token', 'return_array', 'forgot', 'answer'],
533
+        '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'],
534
+        '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'],
535
+        'answerShippingQuery'             => ['ok', 'shipping_query_id', 'shipping_options', 'error_message', 'token', 'return_array', 'forgot', 'answer'],
536
+        'answerPreCheckoutQuery'          => ['ok', 'pre_checkout_query_id', 'error_message', 'token', 'return_array', 'forgot', 'answer'],
537
+        'setPassportDataErrors'           => ['errors', 'user_id', 'token', 'return_array', 'forgot', 'answer'],
538
+        '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'],
539
+        'setGameScore'                    => ['score', 'user_id', 'force', 'disable_edit_message', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'],
540
+        'getGameHighScores'               => ['user_id', 'chat_id', 'message_id', 'inline_message_id', 'token', 'return_array', 'forgot', 'answer'],
541 541
     ];
542 542
 
543 543
     private const METHODS_WITH_FILE = [
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
         'logOut'                          => [],
567 567
         'close'                           => [],
568 568
         'sendMessage'                     => ['chat_id'],
569
-        'forwardMessage'                  => ['from_chat_id','message_id'],
570
-        'copyMessage'                     => ['from_chat_id','message_id'],
569
+        'forwardMessage'                  => ['from_chat_id', 'message_id'],
570
+        'copyMessage'                     => ['from_chat_id', 'message_id'],
571 571
         'sendPhoto'                       => ['chat_id'],
572 572
         'sendAudio'                       => ['chat_id'],
573 573
         'sendDocument'                    => ['chat_id'],
@@ -583,15 +583,15 @@  discard block
 block discarded – undo
583 583
         'sendContact'                     => ['chat_id'],
584 584
         'sendPoll'                        => ['chat_id'],
585 585
         'sendDice'                        => ['chat_id'],
586
-        'sendChatAction'                  => ['chat_id','action'],
586
+        'sendChatAction'                  => ['chat_id', 'action'],
587 587
         'getUserProfilePhotos'            => ['user_id'],
588 588
         'getFile'                         => ['file_id'],
589
-        'banChatMember'                   => ['chat_id','user_id'],
590
-        'kickChatMember'                  => ['chat_id','user_id'],
591
-        'unbanChatMember'                 => ['chat_id','user_id'],
592
-        'restrictChatMember'              => ['chat_id','user_id'],
593
-        'promoteChatMember'               => ['chat_id','user_id'],
594
-        'setChatAdministratorCustomTitle' => ['chat_id','user_id'],
589
+        'banChatMember'                   => ['chat_id', 'user_id'],
590
+        'kickChatMember'                  => ['chat_id', 'user_id'],
591
+        'unbanChatMember'                 => ['chat_id', 'user_id'],
592
+        'restrictChatMember'              => ['chat_id', 'user_id'],
593
+        'promoteChatMember'               => ['chat_id', 'user_id'],
594
+        'setChatAdministratorCustomTitle' => ['chat_id', 'user_id'],
595 595
         'banChatSenderChat'               => ['chat_id'],
596 596
         'unbanChatSenderChat'             => ['chat_id'],
597 597
         'setChatPermissions'              => ['chat_id'],
@@ -599,8 +599,8 @@  discard block
 block discarded – undo
599 599
         'createChatInviteLink'            => ['chat_id'],
600 600
         'editChatInviteLink'              => ['chat_id'],
601 601
         'revokeChatInviteLink'            => ['chat_id'],
602
-        'approveChatJoinRequest'          => ['chat_id','user_id'],
603
-        'declineChatJoinRequest'          => ['chat_id','user_id'],
602
+        'approveChatJoinRequest'          => ['chat_id', 'user_id'],
603
+        'declineChatJoinRequest'          => ['chat_id', 'user_id'],
604 604
         'setChatPhoto'                    => ['chat_id'],
605 605
         'deleteChatPhoto'                 => ['chat_id'],
606 606
         'setChatTitle'                    => ['chat_id'],
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         'getChat'                         => ['chat_id'],
613 613
         'getChatAdministrators'           => ['chat_id'],
614 614
         'getChatMembersCount'             => ['chat_id'],
615
-        'getChatMember'                   => ['chat_id','user_id'],
615
+        'getChatMember'                   => ['chat_id', 'user_id'],
616 616
         'setChatStickerSet'               => ['chat_id'],
617 617
         'deleteChatStickerSet'            => ['chat_id'],
618 618
         'answerCallbackQuery'             => ['callback_query_id'],
@@ -623,12 +623,12 @@  discard block
 block discarded – undo
623 623
         'getChatMenuButton'               => [],
624 624
         'setMyDefaultAdministratorRights' => [],
625 625
         'getMyDefaultAdministratorRights' => [],
626
-        'editMessageText'                 => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
627
-        'editMessageCaption'              => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
628
-        'editMessageMedia'                => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
629
-        'editMessageReplyMarkup'          => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
630
-        'stopPoll'                        => ['chat_id','message_id'],
631
-        'deleteMessage'                   => ['chat_id','message_id'],
626
+        'editMessageText'                 => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
627
+        'editMessageCaption'              => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
628
+        'editMessageMedia'                => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
629
+        'editMessageReplyMarkup'          => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
630
+        'stopPoll'                        => ['chat_id', 'message_id'],
631
+        'deleteMessage'                   => ['chat_id', 'message_id'],
632 632
         'sendSticker'                     => ['chat_id'],
633 633
         'getStickerSet'                   => [],
634 634
         'uploadStickerFile'               => ['user_id'],
@@ -644,8 +644,8 @@  discard block
 block discarded – undo
644 644
         'answerPreCheckoutQuery'          => ['pre_checkout_query_id'],
645 645
         'setPassportDataErrors'           => ['user_id'],
646 646
         'sendGame'                        => ['chat_id'],
647
-        'setGameScore'                    => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']],
648
-        'getGameHighScores'               => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']]
647
+        'setGameScore'                    => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']],
648
+        'getGameHighScores'               => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']]
649 649
     ];
650 650
 
651 651
     private const METHODS_RETURN = [
@@ -697,25 +697,25 @@  discard block
 block discarded – undo
697 697
     ];
698 698
 
699 699
 
700
-    public static function __callStatic (string $name, array $arguments) {
700
+    public static function __callStatic(string $name, array $arguments) {
701 701
         if ($action = self::methodAction($name)) {
702
-            self::keysName($action,$arguments);
703
-            self::readyFile($action,$arguments);
704
-            self::setDefaults($action,$arguments);
702
+            self::keysName($action, $arguments);
703
+            self::readyFile($action, $arguments);
704
+            self::setDefaults($action, $arguments);
705 705
             if (isset($arguments['answer'])) {
706
-                return answer::init($action,$arguments);
706
+                return answer::init($action, $arguments);
707 707
             }
708 708
             else {
709
-                return self::processResponse($action,curl::init($action,$arguments));
709
+                return self::processResponse($action, curl::init($action, $arguments));
710 710
             }
711 711
         }
712 712
         else {
713
-            logger::write("$name method is not supported",loggerTypes::ERROR);
713
+            logger::write("$name method is not supported", loggerTypes::ERROR);
714 714
             throw new bptException('METHOD_NOT_FOUND');
715 715
         }
716 716
     }
717 717
 
718
-    private static function keysName (string $name, array &$arguments): void {
718
+    private static function keysName(string $name, array &$arguments): void {
719 719
         foreach ($arguments as $key => $argument) {
720 720
             if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) {
721 721
                 $arguments[self::METHODS_KEYS[$name][$key]] = $argument;
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
         }
725 725
     }
726 726
 
727
-    private static function methodAction(string $name): string|false {
727
+    private static function methodAction(string $name): string | false {
728 728
         return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false;
729 729
     }
730 730
 
@@ -745,11 +745,11 @@  discard block
 block discarded – undo
745 745
         }
746 746
     }
747 747
 
748
-    private static function methodFile(string $name): array|false {
748
+    private static function methodFile(string $name): array | false {
749 749
         return self::METHODS_WITH_FILE[$name] ?? false;
750 750
     }
751 751
 
752
-    private static function methodReturn(string $name,stdClass $response) {
752
+    private static function methodReturn(string $name, stdClass $response) {
753 753
         if (isset(self::METHODS_RETURN[$name])) {
754 754
             $return = self::METHODS_RETURN[$name];
755 755
             if (is_array($return)) {
@@ -772,13 +772,13 @@  discard block
 block discarded – undo
772 772
         $defaults = self::METHODS_EXTRA_DEFAULTS[$name];
773 773
         foreach ($defaults as $key => $default) {
774 774
             if (is_numeric($key)) {
775
-                if (!isset($arguments[$default])){
775
+                if (!isset($arguments[$default])) {
776 776
                     $arguments[$default] = self::catchFields($default);
777 777
                 }
778 778
             }
779 779
             elseif (isset(BPT::$update->$key) || $key === 'other') {
780 780
                 foreach ($default as $def) {
781
-                    if (!isset($arguments[$def])){
781
+                    if (!isset($arguments[$def])) {
782 782
                         $arguments[$def] = self::catchFields($def);
783 783
                     }
784 784
                 }
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
         if ($response->ok) {
792 792
             self::$status = true;
793 793
             self::$pure_response = $response;
794
-            return self::methodReturn($name,$response);
794
+            return self::methodReturn($name, $response);
795 795
         }
796 796
         else {
797 797
             self::$status = false;
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
      *
808 808
      * @return int|string|bool
809 809
      */
810
-    public static function catchFields (string $field): int|string|bool {
810
+    public static function catchFields(string $field): int | string | bool {
811 811
         switch ($field) {
812 812
             case fields::CHAT_ID :
813 813
             case fields::FROM_CHAT_ID :
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
                     default => false
944 944
                 };
945 945
             case fields::URL :
946
-                return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
946
+                return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
947 947
             default:
948 948
                 return false;
949 949
         }
Please login to merge, or discard this patch.
Braces   +14 added lines, -17 removed lines patch added patch discarded remove patch
@@ -704,12 +704,10 @@  discard block
 block discarded – undo
704 704
             self::setDefaults($action,$arguments);
705 705
             if (isset($arguments['answer'])) {
706 706
                 return answer::init($action,$arguments);
707
-            }
708
-            else {
707
+            } else {
709 708
                 return self::processResponse($action,curl::init($action,$arguments));
710 709
             }
711
-        }
712
-        else {
710
+        } else {
713 711
             logger::write("$name method is not supported",loggerTypes::ERROR);
714 712
             throw new bptException('METHOD_NOT_FOUND');
715 713
         }
@@ -735,8 +733,7 @@  discard block
 block discarded – undo
735 733
                     $arguments['media'][$key]['media'] = new CURLFile($media['media']);
736 734
                 }
737 735
             }
738
-        }
739
-        elseif ($file_params = self::methodFile($name)) {
736
+        } elseif ($file_params = self::methodFile($name)) {
740 737
             foreach ($file_params as $param) {
741 738
                 if (isset($arguments[$param]) && file_exists($arguments[$param])) {
742 739
                     $arguments[$param] = new CURLFile($arguments[$param]);
@@ -758,12 +755,10 @@  discard block
 block discarded – undo
758 755
                     $value = new ($return[0]) ($value);
759 756
                 }
760 757
                 return $response;
761
-            }
762
-            else {
758
+            } else {
763 759
                 return new ($return) ($response->result);
764 760
             }
765
-        }
766
-        else {
761
+        } else {
767 762
             return $response->result;
768 763
         }
769 764
     }
@@ -775,8 +770,7 @@  discard block
 block discarded – undo
775 770
                 if (!isset($arguments[$default])){
776 771
                     $arguments[$default] = self::catchFields($default);
777 772
                 }
778
-            }
779
-            elseif (isset(BPT::$update->$key) || $key === 'other') {
773
+            } elseif (isset(BPT::$update->$key) || $key === 'other') {
780 774
                 foreach ($default as $def) {
781 775
                     if (!isset($arguments[$def])){
782 776
                         $arguments[$def] = self::catchFields($def);
@@ -792,8 +786,7 @@  discard block
 block discarded – undo
792 786
             self::$status = true;
793 787
             self::$pure_response = $response;
794 788
             return self::methodReturn($name,$response);
795
-        }
796
-        else {
789
+        } else {
797 790
             self::$status = false;
798 791
             self::$pure_response = $response;
799 792
             return new responseError($response);
@@ -836,9 +829,13 @@  discard block
 block discarded – undo
836 829
                     default => false
837 830
                 };
838 831
             case fields::FILE_ID :
839
-                if (isset(BPT::$update->message)) $type = 'message';
840
-                elseif (isset(BPT::$update->edited_message)) $type = 'edited_message';
841
-                else return false;
832
+                if (isset(BPT::$update->message)) {
833
+                    $type = 'message';
834
+                } elseif (isset(BPT::$update->edited_message)) {
835
+                    $type = 'edited_message';
836
+                } else {
837
+                    return false;
838
+                }
842 839
 
843 840
                 return match(true) {
844 841
                     isset(BPT::$update->$type->animation) => BPT::$update->$type->animation->file_id,
Please login to merge, or discard this patch.