@@ -504,95 +504,95 @@ discard block |
||
504 | 504 | ]; |
505 | 505 | |
506 | 506 | private const METHODS_KEYS = [ |
507 | - 'getUpdates' => ['offset','limit','timeout','allowed_updates','token','forgot','answer'], |
|
508 | - 'setWebhook' => ['url','certificate','ip_address','max_connections','allowed_updates','drop_pending_updates','secret_token','token','forgot','answer'], |
|
509 | - 'deleteWebhook' => ['drop_pending_updates','token','forgot','answer'], |
|
510 | - 'getWebhookInfo' => ['token','forgot','answer'], |
|
511 | - 'getMe' => ['token','forgot','answer'], |
|
512 | - 'logOut' => ['token','forgot','answer'], |
|
513 | - 'close' => ['token','forgot','answer'], |
|
514 | - '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','forgot','answer','message_thread_id'], |
|
515 | - 'forwardMessage' => ['chat_id','from_chat_id','disable_notification','protect_content','message_id','token','forgot','answer','message_thread_id'], |
|
516 | - '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','forgot','answer','message_thread_id'], |
|
517 | - 'sendPhoto' => ['photo','chat_id','caption','parse_mode','caption_entities','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer','has_spoiler','message_thread_id'], |
|
518 | - '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','forgot','answer','message_thread_id'], |
|
519 | - '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','forgot','answer','message_thread_id'], |
|
520 | - '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','forgot','answer','has_spoiler','message_thread_id'], |
|
521 | - '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','forgot','answer','has_spoiler','message_thread_id'], |
|
522 | - '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','forgot','answer','message_thread_id'], |
|
523 | - 'sendVideoNote' => ['video_note','chat_id','duration','length','thumb','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer','message_thread_id'], |
|
524 | - 'sendMediaGroup' => ['media','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','token','forgot','answer','message_thread_id'], |
|
525 | - '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','forgot','answer','message_thread_id'], |
|
526 | - 'editMessageLiveLocation' => ['latitude','longitude','chat_id','message_id','inline_message_id','horizontal_accuracy','heading','proximity_alert_radius','reply_markup','token','forgot','answer'], |
|
527 | - 'stopMessageLiveLocation' => ['chat_id','message_id','inline_message_id','reply_markup','token','forgot','answer'], |
|
528 | - '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','forgot','answer','message_thread_id'], |
|
529 | - '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','forgot','answer','message_thread_id'], |
|
530 | - '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','forgot','answer','message_thread_id'], |
|
531 | - 'sendDice' => ['chat_id','emoji','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer','message_thread_id'], |
|
532 | - 'sendChatAction' => ['chat_id','action','token','forgot','answer','message_thread_id'], |
|
533 | - 'getUserProfilePhotos' => ['user_id','offset','limit','token','forgot','answer'], |
|
534 | - 'getFile' => ['file_id','token','forgot','answer'], |
|
535 | - 'banChatMember' => ['chat_id','user_id','until_date','revoke_messages','token','forgot','answer'], |
|
536 | - 'unbanChatMember' => ['chat_id','user_id','only_if_banned','token','forgot','answer'], |
|
537 | - 'restrictChatMember' => ['permissions','chat_id','user_id','until_date','token','forgot','answer','use_independent_chat_permissions'], |
|
538 | - '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','can_manage_topics','token','forgot','answer'], |
|
539 | - 'setChatAdministratorCustomTitle' => ['custom_title','chat_id','user_id','token','forgot','answer'], |
|
540 | - 'banChatSenderChat' => ['sender_chat_id','chat_id','token','forgot','answer'], |
|
541 | - 'unbanChatSenderChat' => ['sender_chat_id','chat_id','token','forgot','answer'], |
|
542 | - 'setChatPermissions' => ['permissions','chat_id','token','forgot','answer','use_independent_chat_permissions'], |
|
543 | - 'exportChatInviteLink' => ['chat_id','token','forgot','answer'], |
|
544 | - 'createChatInviteLink' => ['chat_id','name','expire_date','member_limit','creates_join_request','token','forgot','answer'], |
|
545 | - 'editChatInviteLink' => ['invite_link','chat_id','name','expire_date','member_limit','creates_join_request','token','forgot','answer'], |
|
546 | - 'revokeChatInviteLink' => ['invite_link','chat_id','token','forgot','answer'], |
|
547 | - 'approveChatJoinRequest' => ['chat_id','user_id','token','forgot','answer'], |
|
548 | - 'declineChatJoinRequest' => ['chat_id','user_id','token','forgot','answer'], |
|
549 | - 'setChatPhoto' => ['photo','chat_id','token','forgot','answer'], |
|
550 | - 'deleteChatPhoto' => ['chat_id','token','forgot','answer'], |
|
551 | - 'setChatTitle' => ['title','chat_id','token','forgot','answer'], |
|
552 | - 'setChatDescription' => ['chat_id','description','token','forgot','answer'], |
|
553 | - 'pinChatMessage' => ['message_id','chat_id','disable_notification','token','forgot','answer'], |
|
554 | - 'unpinChatMessage' => ['chat_id','message_id','token','forgot','answer'], |
|
555 | - 'unpinAllChatMessages' => ['chat_id','token','forgot','answer'], |
|
556 | - 'leaveChat' => ['chat_id','token','forgot','answer'], |
|
557 | - 'getChat' => ['chat_id','token','forgot','answer'], |
|
558 | - 'getChatAdministrators' => ['chat_id','token','forgot','answer'], |
|
559 | - 'getChatMemberCount' => ['chat_id','token','forgot','answer'], |
|
560 | - 'getChatMember' => ['chat_id','user_id','token','forgot','answer'], |
|
561 | - 'setChatStickerSet' => ['sticker_set_name','chat_id','token','forgot','answer'], |
|
562 | - 'deleteChatStickerSet' => ['chat_id','token','forgot','answer'], |
|
563 | - 'answerCallbackQuery' => ['callback_query_id','text','show_alert','url','cache_time','token','forgot','answer'], |
|
564 | - 'setMyCommands' => ['commands','scope','language_code','token','forgot','answer'], |
|
565 | - 'deleteMyCommands' => ['scope','language_code','token','forgot','answer'], |
|
566 | - 'getMyCommands' => ['scope','language_code','token','forgot','answer'], |
|
567 | - 'setChatMenuButton' => ['chat_id','menu_button','token','forgot','answer'], |
|
568 | - 'getChatMenuButton' => ['chat_id','token','forgot','answer'], |
|
569 | - 'setMyDefaultAdministratorRights' => ['rights','for_channels','token','forgot','answer'], |
|
570 | - 'getMyDefaultAdministratorRights' => ['for_channels','token','forgot','answer'], |
|
571 | - 'editMessageText' => ['text','chat_id','message_id','inline_message_id','parse_mode','entities','disable_web_page_preview','reply_markup','token','forgot','answer'], |
|
572 | - 'editMessageCaption' => ['chat_id','message_id','inline_message_id','caption','parse_mode','caption_entities','reply_markup','token','forgot','answer'], |
|
573 | - 'editMessageMedia' => ['media','chat_id','message_id','inline_message_id','reply_markup','token','forgot','answer'], |
|
574 | - 'editMessageReplyMarkup' => ['chat_id','message_id','inline_message_id','reply_markup','token','forgot','answer'], |
|
575 | - 'stopPoll' => ['chat_id','message_id','reply_markup','token','forgot','answer'], |
|
576 | - 'deleteMessage' => ['chat_id','message_id','token','forgot','answer'], |
|
577 | - 'sendSticker' => ['sticker','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer','message_thread_id'], |
|
578 | - 'getStickerSet' => ['name','token','forgot','answer'], |
|
507 | + 'getUpdates' => ['offset', 'limit', 'timeout', 'allowed_updates', 'token', 'forgot', 'answer'], |
|
508 | + 'setWebhook' => ['url', 'certificate', 'ip_address', 'max_connections', 'allowed_updates', 'drop_pending_updates', 'secret_token', 'token', 'forgot', 'answer'], |
|
509 | + 'deleteWebhook' => ['drop_pending_updates', 'token', 'forgot', 'answer'], |
|
510 | + 'getWebhookInfo' => ['token', 'forgot', 'answer'], |
|
511 | + 'getMe' => ['token', 'forgot', 'answer'], |
|
512 | + 'logOut' => ['token', 'forgot', 'answer'], |
|
513 | + 'close' => ['token', 'forgot', 'answer'], |
|
514 | + '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', 'forgot', 'answer', 'message_thread_id'], |
|
515 | + 'forwardMessage' => ['chat_id', 'from_chat_id', 'disable_notification', 'protect_content', 'message_id', 'token', 'forgot', 'answer', 'message_thread_id'], |
|
516 | + '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', 'forgot', 'answer', 'message_thread_id'], |
|
517 | + 'sendPhoto' => ['photo', 'chat_id', 'caption', 'parse_mode', 'caption_entities', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer', 'has_spoiler', 'message_thread_id'], |
|
518 | + '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', 'forgot', 'answer', 'message_thread_id'], |
|
519 | + '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', 'forgot', 'answer', 'message_thread_id'], |
|
520 | + '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', 'forgot', 'answer', 'has_spoiler', 'message_thread_id'], |
|
521 | + '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', 'forgot', 'answer', 'has_spoiler', 'message_thread_id'], |
|
522 | + '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', 'forgot', 'answer', 'message_thread_id'], |
|
523 | + 'sendVideoNote' => ['video_note', 'chat_id', 'duration', 'length', 'thumb', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer', 'message_thread_id'], |
|
524 | + 'sendMediaGroup' => ['media', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'token', 'forgot', 'answer', 'message_thread_id'], |
|
525 | + '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', 'forgot', 'answer', 'message_thread_id'], |
|
526 | + 'editMessageLiveLocation' => ['latitude', 'longitude', 'chat_id', 'message_id', 'inline_message_id', 'horizontal_accuracy', 'heading', 'proximity_alert_radius', 'reply_markup', 'token', 'forgot', 'answer'], |
|
527 | + 'stopMessageLiveLocation' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'forgot', 'answer'], |
|
528 | + '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', 'forgot', 'answer', 'message_thread_id'], |
|
529 | + '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', 'forgot', 'answer', 'message_thread_id'], |
|
530 | + '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', 'forgot', 'answer', 'message_thread_id'], |
|
531 | + 'sendDice' => ['chat_id', 'emoji', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer', 'message_thread_id'], |
|
532 | + 'sendChatAction' => ['chat_id', 'action', 'token', 'forgot', 'answer', 'message_thread_id'], |
|
533 | + 'getUserProfilePhotos' => ['user_id', 'offset', 'limit', 'token', 'forgot', 'answer'], |
|
534 | + 'getFile' => ['file_id', 'token', 'forgot', 'answer'], |
|
535 | + 'banChatMember' => ['chat_id', 'user_id', 'until_date', 'revoke_messages', 'token', 'forgot', 'answer'], |
|
536 | + 'unbanChatMember' => ['chat_id', 'user_id', 'only_if_banned', 'token', 'forgot', 'answer'], |
|
537 | + 'restrictChatMember' => ['permissions', 'chat_id', 'user_id', 'until_date', 'token', 'forgot', 'answer', 'use_independent_chat_permissions'], |
|
538 | + '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', 'can_manage_topics', 'token', 'forgot', 'answer'], |
|
539 | + 'setChatAdministratorCustomTitle' => ['custom_title', 'chat_id', 'user_id', 'token', 'forgot', 'answer'], |
|
540 | + 'banChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'forgot', 'answer'], |
|
541 | + 'unbanChatSenderChat' => ['sender_chat_id', 'chat_id', 'token', 'forgot', 'answer'], |
|
542 | + 'setChatPermissions' => ['permissions', 'chat_id', 'token', 'forgot', 'answer', 'use_independent_chat_permissions'], |
|
543 | + 'exportChatInviteLink' => ['chat_id', 'token', 'forgot', 'answer'], |
|
544 | + 'createChatInviteLink' => ['chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'forgot', 'answer'], |
|
545 | + 'editChatInviteLink' => ['invite_link', 'chat_id', 'name', 'expire_date', 'member_limit', 'creates_join_request', 'token', 'forgot', 'answer'], |
|
546 | + 'revokeChatInviteLink' => ['invite_link', 'chat_id', 'token', 'forgot', 'answer'], |
|
547 | + 'approveChatJoinRequest' => ['chat_id', 'user_id', 'token', 'forgot', 'answer'], |
|
548 | + 'declineChatJoinRequest' => ['chat_id', 'user_id', 'token', 'forgot', 'answer'], |
|
549 | + 'setChatPhoto' => ['photo', 'chat_id', 'token', 'forgot', 'answer'], |
|
550 | + 'deleteChatPhoto' => ['chat_id', 'token', 'forgot', 'answer'], |
|
551 | + 'setChatTitle' => ['title', 'chat_id', 'token', 'forgot', 'answer'], |
|
552 | + 'setChatDescription' => ['chat_id', 'description', 'token', 'forgot', 'answer'], |
|
553 | + 'pinChatMessage' => ['message_id', 'chat_id', 'disable_notification', 'token', 'forgot', 'answer'], |
|
554 | + 'unpinChatMessage' => ['chat_id', 'message_id', 'token', 'forgot', 'answer'], |
|
555 | + 'unpinAllChatMessages' => ['chat_id', 'token', 'forgot', 'answer'], |
|
556 | + 'leaveChat' => ['chat_id', 'token', 'forgot', 'answer'], |
|
557 | + 'getChat' => ['chat_id', 'token', 'forgot', 'answer'], |
|
558 | + 'getChatAdministrators' => ['chat_id', 'token', 'forgot', 'answer'], |
|
559 | + 'getChatMemberCount' => ['chat_id', 'token', 'forgot', 'answer'], |
|
560 | + 'getChatMember' => ['chat_id', 'user_id', 'token', 'forgot', 'answer'], |
|
561 | + 'setChatStickerSet' => ['sticker_set_name', 'chat_id', 'token', 'forgot', 'answer'], |
|
562 | + 'deleteChatStickerSet' => ['chat_id', 'token', 'forgot', 'answer'], |
|
563 | + 'answerCallbackQuery' => ['callback_query_id', 'text', 'show_alert', 'url', 'cache_time', 'token', 'forgot', 'answer'], |
|
564 | + 'setMyCommands' => ['commands', 'scope', 'language_code', 'token', 'forgot', 'answer'], |
|
565 | + 'deleteMyCommands' => ['scope', 'language_code', 'token', 'forgot', 'answer'], |
|
566 | + 'getMyCommands' => ['scope', 'language_code', 'token', 'forgot', 'answer'], |
|
567 | + 'setChatMenuButton' => ['chat_id', 'menu_button', 'token', 'forgot', 'answer'], |
|
568 | + 'getChatMenuButton' => ['chat_id', 'token', 'forgot', 'answer'], |
|
569 | + 'setMyDefaultAdministratorRights' => ['rights', 'for_channels', 'token', 'forgot', 'answer'], |
|
570 | + 'getMyDefaultAdministratorRights' => ['for_channels', 'token', 'forgot', 'answer'], |
|
571 | + 'editMessageText' => ['text', 'chat_id', 'message_id', 'inline_message_id', 'parse_mode', 'entities', 'disable_web_page_preview', 'reply_markup', 'token', 'forgot', 'answer'], |
|
572 | + 'editMessageCaption' => ['chat_id', 'message_id', 'inline_message_id', 'caption', 'parse_mode', 'caption_entities', 'reply_markup', 'token', 'forgot', 'answer'], |
|
573 | + 'editMessageMedia' => ['media', 'chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'forgot', 'answer'], |
|
574 | + 'editMessageReplyMarkup' => ['chat_id', 'message_id', 'inline_message_id', 'reply_markup', 'token', 'forgot', 'answer'], |
|
575 | + 'stopPoll' => ['chat_id', 'message_id', 'reply_markup', 'token', 'forgot', 'answer'], |
|
576 | + 'deleteMessage' => ['chat_id', 'message_id', 'token', 'forgot', 'answer'], |
|
577 | + 'sendSticker' => ['sticker', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer', 'message_thread_id'], |
|
578 | + 'getStickerSet' => ['name', 'token', 'forgot', 'answer'], |
|
579 | 579 | 'getCustomEmojiStickers' => ['custom_emoji_ids', 'token', 'return_array', 'forgot', 'answer'], |
580 | - 'uploadStickerFile' => ['png_sticker','user_id','token','forgot','answer'], |
|
581 | - 'createNewStickerSet' => ['name','title','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','sticker_type','contains_masks','mask_position','token','forgot','answer'], |
|
582 | - 'addStickerToSet' => ['name','emojis','user_id','png_sticker','tgs_sticker','webm_sticker','mask_position','token','forgot','answer'], |
|
583 | - 'setStickerPositionInSet' => ['sticker','position','token','forgot','answer'], |
|
584 | - 'deleteStickerFromSet' => ['sticker','token','forgot','answer'], |
|
585 | - 'setStickerSetThumb' => ['name','user_id','thumb','token','forgot','answer'], |
|
586 | - 'answerInlineQuery' => ['results','inline_query_id','cache_time','is_personal','next_offset','switch_pm_text','switch_pm_parameter','token','forgot','answer'], |
|
587 | - 'answerWebAppQuery' => ['web_app_query_id','result','token','forgot','answer'], |
|
588 | - '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','forgot','answer','message_thread_id'], |
|
589 | - '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','forgot','answer'], |
|
590 | - 'answerShippingQuery' => ['ok','shipping_query_id','shipping_options','error_message','token','forgot','answer'], |
|
591 | - 'answerPreCheckoutQuery' => ['ok','pre_checkout_query_id','error_message','token','forgot','answer'], |
|
592 | - 'setPassportDataErrors' => ['errors','user_id','token','forgot','answer'], |
|
593 | - 'sendGame' => ['game_short_name','chat_id','disable_notification','protect_content','reply_to_message_id','allow_sending_without_reply','reply_markup','token','forgot','answer', 'message_thread_id'], |
|
594 | - 'setGameScore' => ['score','user_id','force','disable_edit_message','chat_id','message_id','inline_message_id','token','forgot','answer'], |
|
595 | - 'getGameHighScores' => ['user_id','chat_id','message_id','inline_message_id','token','forgot','answer'], |
|
580 | + 'uploadStickerFile' => ['png_sticker', 'user_id', 'token', 'forgot', 'answer'], |
|
581 | + 'createNewStickerSet' => ['name', 'title', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'sticker_type', 'contains_masks', 'mask_position', 'token', 'forgot', 'answer'], |
|
582 | + 'addStickerToSet' => ['name', 'emojis', 'user_id', 'png_sticker', 'tgs_sticker', 'webm_sticker', 'mask_position', 'token', 'forgot', 'answer'], |
|
583 | + 'setStickerPositionInSet' => ['sticker', 'position', 'token', 'forgot', 'answer'], |
|
584 | + 'deleteStickerFromSet' => ['sticker', 'token', 'forgot', 'answer'], |
|
585 | + 'setStickerSetThumb' => ['name', 'user_id', 'thumb', 'token', 'forgot', 'answer'], |
|
586 | + 'answerInlineQuery' => ['results', 'inline_query_id', 'cache_time', 'is_personal', 'next_offset', 'switch_pm_text', 'switch_pm_parameter', 'token', 'forgot', 'answer'], |
|
587 | + 'answerWebAppQuery' => ['web_app_query_id', 'result', 'token', 'forgot', 'answer'], |
|
588 | + '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', 'forgot', 'answer', 'message_thread_id'], |
|
589 | + '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', 'forgot', 'answer'], |
|
590 | + 'answerShippingQuery' => ['ok', 'shipping_query_id', 'shipping_options', 'error_message', 'token', 'forgot', 'answer'], |
|
591 | + 'answerPreCheckoutQuery' => ['ok', 'pre_checkout_query_id', 'error_message', 'token', 'forgot', 'answer'], |
|
592 | + 'setPassportDataErrors' => ['errors', 'user_id', 'token', 'forgot', 'answer'], |
|
593 | + 'sendGame' => ['game_short_name', 'chat_id', 'disable_notification', 'protect_content', 'reply_to_message_id', 'allow_sending_without_reply', 'reply_markup', 'token', 'forgot', 'answer', 'message_thread_id'], |
|
594 | + 'setGameScore' => ['score', 'user_id', 'force', 'disable_edit_message', 'chat_id', 'message_id', 'inline_message_id', 'token', 'forgot', 'answer'], |
|
595 | + 'getGameHighScores' => ['user_id', 'chat_id', 'message_id', 'inline_message_id', 'token', 'forgot', 'answer'], |
|
596 | 596 | 'getForumTopicIconStickers' => ['token', 'return_array', 'forgot', 'answer'], |
597 | 597 | 'createForumTopic' => ['chat_id', 'name', 'icon_color', 'icon_custom_emoji_id', 'token', 'return_array', 'forgot', 'answer'], |
598 | 598 | 'editForumTopic' => ['chat_id', 'name', 'icon_custom_emoji_id', 'token', 'return_array', 'forgot', 'answer', 'message_thread_id'], |
@@ -633,8 +633,8 @@ discard block |
||
633 | 633 | 'logOut' => [], |
634 | 634 | 'close' => [], |
635 | 635 | 'sendMessage' => ['chat_id'], |
636 | - 'forwardMessage' => ['from_chat_id','message_id'], |
|
637 | - 'copyMessage' => ['from_chat_id','message_id'], |
|
636 | + 'forwardMessage' => ['from_chat_id', 'message_id'], |
|
637 | + 'copyMessage' => ['from_chat_id', 'message_id'], |
|
638 | 638 | 'sendPhoto' => ['chat_id'], |
639 | 639 | 'sendAudio' => ['chat_id'], |
640 | 640 | 'sendDocument' => ['chat_id'], |
@@ -650,15 +650,15 @@ discard block |
||
650 | 650 | 'sendContact' => ['chat_id'], |
651 | 651 | 'sendPoll' => ['chat_id'], |
652 | 652 | 'sendDice' => ['chat_id'], |
653 | - 'sendChatAction' => ['chat_id','action'], |
|
653 | + 'sendChatAction' => ['chat_id', 'action'], |
|
654 | 654 | 'getUserProfilePhotos' => ['user_id'], |
655 | 655 | 'getFile' => ['file_id'], |
656 | - 'banChatMember' => ['chat_id','user_id'], |
|
657 | - 'kickChatMember' => ['chat_id','user_id'], |
|
658 | - 'unbanChatMember' => ['chat_id','user_id'], |
|
659 | - 'restrictChatMember' => ['chat_id','user_id'], |
|
660 | - 'promoteChatMember' => ['chat_id','user_id'], |
|
661 | - 'setChatAdministratorCustomTitle' => ['chat_id','user_id'], |
|
656 | + 'banChatMember' => ['chat_id', 'user_id'], |
|
657 | + 'kickChatMember' => ['chat_id', 'user_id'], |
|
658 | + 'unbanChatMember' => ['chat_id', 'user_id'], |
|
659 | + 'restrictChatMember' => ['chat_id', 'user_id'], |
|
660 | + 'promoteChatMember' => ['chat_id', 'user_id'], |
|
661 | + 'setChatAdministratorCustomTitle' => ['chat_id', 'user_id'], |
|
662 | 662 | 'banChatSenderChat' => ['chat_id'], |
663 | 663 | 'unbanChatSenderChat' => ['chat_id'], |
664 | 664 | 'setChatPermissions' => ['chat_id'], |
@@ -666,8 +666,8 @@ discard block |
||
666 | 666 | 'createChatInviteLink' => ['chat_id'], |
667 | 667 | 'editChatInviteLink' => ['chat_id'], |
668 | 668 | 'revokeChatInviteLink' => ['chat_id'], |
669 | - 'approveChatJoinRequest' => ['chat_id','user_id'], |
|
670 | - 'declineChatJoinRequest' => ['chat_id','user_id'], |
|
669 | + 'approveChatJoinRequest' => ['chat_id', 'user_id'], |
|
670 | + 'declineChatJoinRequest' => ['chat_id', 'user_id'], |
|
671 | 671 | 'setChatPhoto' => ['chat_id'], |
672 | 672 | 'deleteChatPhoto' => ['chat_id'], |
673 | 673 | 'setChatTitle' => ['chat_id'], |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | 'getChat' => ['chat_id'], |
680 | 680 | 'getChatAdministrators' => ['chat_id'], |
681 | 681 | 'getChatMembersCount' => ['chat_id'], |
682 | - 'getChatMember' => ['chat_id','user_id'], |
|
682 | + 'getChatMember' => ['chat_id', 'user_id'], |
|
683 | 683 | 'setChatStickerSet' => ['chat_id'], |
684 | 684 | 'deleteChatStickerSet' => ['chat_id'], |
685 | 685 | 'answerCallbackQuery' => ['callback_query_id'], |
@@ -690,12 +690,12 @@ discard block |
||
690 | 690 | 'getChatMenuButton' => [], |
691 | 691 | 'setMyDefaultAdministratorRights' => [], |
692 | 692 | 'getMyDefaultAdministratorRights' => [], |
693 | - 'editMessageText' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
694 | - 'editMessageCaption' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
695 | - 'editMessageMedia' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
696 | - 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
697 | - 'stopPoll' => ['chat_id','message_id'], |
|
698 | - 'deleteMessage' => ['chat_id','message_id'], |
|
693 | + 'editMessageText' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
694 | + 'editMessageCaption' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
695 | + 'editMessageMedia' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
696 | + 'editMessageReplyMarkup' => ['inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
697 | + 'stopPoll' => ['chat_id', 'message_id'], |
|
698 | + 'deleteMessage' => ['chat_id', 'message_id'], |
|
699 | 699 | 'sendSticker' => ['chat_id'], |
700 | 700 | 'getStickerSet' => [], |
701 | 701 | 'uploadStickerFile' => ['user_id'], |
@@ -711,8 +711,8 @@ discard block |
||
711 | 711 | 'answerPreCheckoutQuery' => ['pre_checkout_query_id'], |
712 | 712 | 'setPassportDataErrors' => ['user_id'], |
713 | 713 | 'sendGame' => ['chat_id'], |
714 | - 'setGameScore' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']], |
|
715 | - 'getGameHighScores' => ['user_id','inline_query'=>['inline_message_id'],'other'=>['chat_id','message_id']] |
|
714 | + 'setGameScore' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']], |
|
715 | + 'getGameHighScores' => ['user_id', 'inline_query'=>['inline_message_id'], 'other'=>['chat_id', 'message_id']] |
|
716 | 716 | ]; |
717 | 717 | |
718 | 718 | private const METHODS_RETURN = [ |
@@ -766,29 +766,29 @@ discard block |
||
766 | 766 | 'getGameHighScores' => ['BPT\types\gameHighScore'] |
767 | 767 | ]; |
768 | 768 | |
769 | - public static function __callStatic (string $name, array $arguments) { |
|
769 | + public static function __callStatic(string $name, array $arguments) { |
|
770 | 770 | if (!$action = self::methodAction($name)) { |
771 | - logger::write("$name method is not supported",loggerTypes::ERROR); |
|
771 | + logger::write("$name method is not supported", loggerTypes::ERROR); |
|
772 | 772 | throw new bptException('METHOD_NOT_FOUND'); |
773 | 773 | } |
774 | 774 | self::checkArguments($arguments); |
775 | - self::keysName($action,$arguments); |
|
776 | - self::readyFile($action,$arguments); |
|
775 | + self::keysName($action, $arguments); |
|
776 | + self::readyFile($action, $arguments); |
|
777 | 777 | self::cleanArguments($arguments); |
778 | - self::setDefaults($action,$arguments); |
|
778 | + self::setDefaults($action, $arguments); |
|
779 | 779 | |
780 | 780 | if (isset($arguments['answer']) && $arguments['answer'] === true) { |
781 | 781 | unset($arguments['answer']); |
782 | 782 | if (!answer::isAnswered()) { |
783 | - return answer::init($action,$arguments); |
|
783 | + return answer::init($action, $arguments); |
|
784 | 784 | } |
785 | - logger::write('you can use answer mode only once for each webhook update, Others will be called like normal',loggerTypes::WARNING); |
|
785 | + logger::write('you can use answer mode only once for each webhook update, Others will be called like normal', loggerTypes::WARNING); |
|
786 | 786 | } |
787 | - $result = curl::init($action,$arguments); |
|
787 | + $result = curl::init($action, $arguments); |
|
788 | 788 | if (!is_object($result)) { |
789 | 789 | return false; |
790 | 790 | } |
791 | - return self::processResponse($action,$result); |
|
791 | + return self::processResponse($action, $result); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | private static function checkArguments(array &$arguments): void { |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | } |
798 | 798 | } |
799 | 799 | |
800 | - private static function keysName (string $name, array &$arguments): void { |
|
800 | + private static function keysName(string $name, array &$arguments): void { |
|
801 | 801 | foreach ($arguments as $key => $argument) { |
802 | 802 | if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) { |
803 | 803 | $arguments[self::METHODS_KEYS[$name][$key]] = $argument; |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | } |
807 | 807 | } |
808 | 808 | |
809 | - private static function methodAction(string $name): string|false { |
|
809 | + private static function methodAction(string $name): string | false { |
|
810 | 810 | return self::METHODS_ACTION[str_replace('_', '', strtolower($name))] ?? false; |
811 | 811 | } |
812 | 812 | |
@@ -839,11 +839,11 @@ discard block |
||
839 | 839 | } |
840 | 840 | } |
841 | 841 | |
842 | - private static function methodFile(string $name): array|false { |
|
842 | + private static function methodFile(string $name): array | false { |
|
843 | 843 | return self::METHODS_WITH_FILE[$name] ?? false; |
844 | 844 | } |
845 | 845 | |
846 | - private static function methodReturn(string $name,stdClass $response) { |
|
846 | + private static function methodReturn(string $name, stdClass $response) { |
|
847 | 847 | if (!isset(self::METHODS_RETURN[$name])) { |
848 | 848 | return $response->result; |
849 | 849 | } |
@@ -862,13 +862,13 @@ discard block |
||
862 | 862 | $defaults = self::METHODS_EXTRA_DEFAULTS[$name]; |
863 | 863 | foreach ($defaults as $key => $default) { |
864 | 864 | if (is_numeric($key)) { |
865 | - if (!isset($arguments[$default])){ |
|
865 | + if (!isset($arguments[$default])) { |
|
866 | 866 | $arguments[$default] = self::catchFields($default); |
867 | 867 | } |
868 | 868 | } |
869 | 869 | elseif (isset(BPT::$update->$key) || $key === 'other') { |
870 | 870 | foreach ($default as $def) { |
871 | - if (!isset($arguments[$def])){ |
|
871 | + if (!isset($arguments[$def])) { |
|
872 | 872 | $arguments[$def] = self::catchFields($def); |
873 | 873 | } |
874 | 874 | } |
@@ -887,13 +887,13 @@ discard block |
||
887 | 887 | self::$status = $response->ok; |
888 | 888 | self::$pure_response = $response; |
889 | 889 | if (!$response->ok) { |
890 | - logger::write("Telegram $name method failed : " . json_encode($response), loggerTypes::WARNING); |
|
890 | + logger::write("Telegram $name method failed : ".json_encode($response), loggerTypes::WARNING); |
|
891 | 891 | return new responseError($response); |
892 | 892 | } |
893 | - return self::methodReturn($name,$response); |
|
893 | + return self::methodReturn($name, $response); |
|
894 | 894 | } |
895 | 895 | |
896 | - private static function cleanArguments (array &$arguments): void { |
|
896 | + private static function cleanArguments(array &$arguments): void { |
|
897 | 897 | foreach ($arguments as $key => $argument) { |
898 | 898 | if ($argument == [] || $argument === null) { |
899 | 899 | unset($arguments[$key]); |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | * |
909 | 909 | * @return int|string|bool |
910 | 910 | */ |
911 | - public static function catchFields (string $field): int|string|bool { |
|
911 | + public static function catchFields(string $field): int | string | bool { |
|
912 | 912 | switch ($field) { |
913 | 913 | case fields::CHAT_ID : |
914 | 914 | case fields::FROM_CHAT_ID : |
@@ -1055,13 +1055,13 @@ discard block |
||
1055 | 1055 | default => false |
1056 | 1056 | }; |
1057 | 1057 | case fields::URL : |
1058 | - return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
1058 | + return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
1059 | 1059 | default: |
1060 | 1060 | return false; |
1061 | 1061 | } |
1062 | 1062 | } |
1063 | 1063 | |
1064 | - public static function fileLink (string|null $file_id = null): bool|string { |
|
1064 | + public static function fileLink(string | null $file_id = null): bool | string { |
|
1065 | 1065 | $file = request::getFile($file_id); |
1066 | 1066 | if (!isset($file->file_path)) { |
1067 | 1067 | return false; |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | * |
1084 | 1084 | * @return bool |
1085 | 1085 | */ |
1086 | - public static function downloadFile (string|null $destination = null, string|null $file_id = null): bool { |
|
1086 | + public static function downloadFile(string | null $destination = null, string | null $file_id = null): bool { |
|
1087 | 1087 | return tools::downloadFile(self::fileLink($file_id), $destination); |
1088 | 1088 | } |
1089 | 1089 | |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | * |
1102 | 1102 | * @return message|bool|responseError |
1103 | 1103 | */ |
1104 | - public static function sendFile (string $file_id, int|string $chat_id = null, int $message_thread_id = null, string $caption = null, string $parse_mode = null, array $caption_entities = null, bool $disable_notification = null, bool $protect_content = null, int $reply_to_message_id = null, bool $allow_sending_without_reply = null, inlineKeyboardMarkup|replyKeyboardMarkup|replyKeyboardRemove|forceReply|stdClass|array $reply_markup = null, string $token = null, bool $forgot = null, bool $answer = null): message|bool|responseError { |
|
1104 | + public static function sendFile(string $file_id, int | string $chat_id = null, int $message_thread_id = null, string $caption = null, string $parse_mode = null, array $caption_entities = null, bool $disable_notification = null, bool $protect_content = null, int $reply_to_message_id = null, bool $allow_sending_without_reply = null, inlineKeyboardMarkup | replyKeyboardMarkup | replyKeyboardRemove | forceReply | stdClass | array $reply_markup = null, string $token = null, bool $forgot = null, bool $answer = null): message | bool | responseError { |
|
1105 | 1105 | $type = tools::fileType($file_id); |
1106 | 1106 | return match ($type) { |
1107 | 1107 | fileTypes::VIDEO => request::sendVideo($file_id, $chat_id, null, null, null, null, $caption, $parse_mode, $caption_entities, null, $disable_notification, $protect_content, $reply_to_message_id, $allow_sending_without_reply, $reply_markup, $token, $forgot, $answer, $message_thread_id), |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return bool|int |
37 | 37 | */ |
38 | - public static function save(string $name, string $data): bool|int { |
|
39 | - return file_put_contents(settings::$name."$name.lock", $data) && chmod(settings::$name."$name.lock",0640); |
|
38 | + public static function save(string $name, string $data): bool | int { |
|
39 | + return file_put_contents(settings::$name."$name.lock", $data) && chmod(settings::$name."$name.lock", 0640); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return bool|string |
48 | 48 | */ |
49 | - public static function read(string $name): bool|string { |
|
49 | + public static function read(string $name): bool | string { |
|
50 | 50 | return file_get_contents(realpath(settings::$name."$name.lock")); |
51 | 51 | } |
52 | 52 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return bool|int |
59 | 59 | */ |
60 | - public static function mtime(string $name): bool|int { |
|
60 | + public static function mtime(string $name): bool | int { |
|
61 | 61 | return filemtime(realpath(settings::$name."$name.lock")); |
62 | 62 | } |
63 | 63 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return bool |
81 | 81 | */ |
82 | - public static function deleteIfExist (string|array $names): bool { |
|
82 | + public static function deleteIfExist(string | array $names): bool { |
|
83 | 83 | if (is_string($names)) { |
84 | 84 | $names = [$names]; |
85 | 85 | } |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | * curl class , for multiprocessing with curl tricks |
15 | 15 | */ |
16 | 16 | class curl extends webhook { |
17 | - public static function init (): string|null { |
|
17 | + public static function init(): string | null { |
|
18 | 18 | if (!self::checkIP()) { |
19 | - logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING); |
|
19 | + logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING); |
|
20 | 20 | BPT::exit(); |
21 | 21 | } |
22 | 22 | return self::getUpdate(); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | return $_SERVER['REMOTE_ADDR'] === $_SERVER['SERVER_ADDR']; |
27 | 27 | } |
28 | 28 | |
29 | - private static function getUpdate (): string { |
|
29 | + private static function getUpdate(): string { |
|
30 | 30 | $input = json_decode(file_get_contents("php://input"), true); |
31 | 31 | webhook::telegramVerify($input['ip']); |
32 | 32 | return $input['update']; |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | lock::set('BPT-MULTI-CURL'); |
44 | 44 | } |
45 | 45 | |
46 | - private static function getTimeout($url): float|int { |
|
46 | + private static function getTimeout($url): float | int { |
|
47 | 47 | $times = []; |
48 | - for ($i = 0; $i < 10; $i ++) { |
|
48 | + for ($i = 0; $i < 10; $i++) { |
|
49 | 49 | $ch = curl_init($url); |
50 | 50 | curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([]), CURLOPT_TIMEOUT_MS => 100, CURLOPT_NOBODY => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => 100, CURLOPT_HTTPHEADER => ['accept: application/json', 'content-type: application/json']]); |
51 | 51 | $start = microtime(true); |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | return $timeout > 50 ? $timeout + 10 : 50; |
57 | 57 | } |
58 | 58 | |
59 | - private static function create($file,$timeout) { |
|
60 | - file_put_contents('receiver.php', '<?php http_response_code(200);ignore_user_abort();$ch = curl_init(\'' . $file . '\');curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([\'update\'=>file_get_contents(\'php://input\'),\'ip\'=>$_SERVER[\'REMOTE_ADDR\']]), CURLOPT_TIMEOUT_MS => ' . $timeout . ', CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => ' . $timeout . ', CURLOPT_HTTPHEADER => [\'accept: application/json\', \'content-type: application/json\']]);curl_exec($ch);curl_close($ch);?>'); |
|
59 | + private static function create($file, $timeout) { |
|
60 | + file_put_contents('receiver.php', '<?php http_response_code(200);ignore_user_abort();$ch = curl_init(\''.$file.'\');curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([\'update\'=>file_get_contents(\'php://input\'),\'ip\'=>$_SERVER[\'REMOTE_ADDR\']]), CURLOPT_TIMEOUT_MS => '.$timeout.', CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => '.$timeout.', CURLOPT_HTTPHEADER => [\'accept: application/json\', \'content-type: application/json\']]);curl_exec($ch);curl_close($ch);?>'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | #[ArrayShape(['url' => "array|string|string[]", 'file' => "array|string|string[]"])] |
64 | 64 | private static function setURLS(): array { |
65 | - $base_url = (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
65 | + $base_url = (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
66 | 66 | $file = basename($_SERVER['REQUEST_URI']); |
67 | 67 | return [ |
68 | 68 | 'url'=>str_replace($file, 'receiver.php', $base_url), |
@@ -16,31 +16,31 @@ |
||
16 | 16 | */ |
17 | 17 | class getUpdates extends receiver { |
18 | 18 | #[NoReturn] |
19 | - public static function init () { |
|
19 | + public static function init() { |
|
20 | 20 | $last_update_id = self::loadData(); |
21 | 21 | lock::set('getUpdateHook'); |
22 | - while(true) { |
|
22 | + while (true) { |
|
23 | 23 | if (!lock::exist('getUpdateHook')) { |
24 | 24 | break; |
25 | 25 | } |
26 | - $updates = telegram::getUpdates($last_update_id,allowed_updates: settings::$allowed_updates); |
|
26 | + $updates = telegram::getUpdates($last_update_id, allowed_updates: settings::$allowed_updates); |
|
27 | 27 | if (!telegram::$status) { |
28 | - logger::write("There is some problem happened , telegram response : \n".json_encode($updates),loggerTypes::ERROR); |
|
29 | - BPT::exit(print_r($updates,true)); |
|
28 | + logger::write("There is some problem happened , telegram response : \n".json_encode($updates), loggerTypes::ERROR); |
|
29 | + BPT::exit(print_r($updates, true)); |
|
30 | 30 | } |
31 | 31 | self::handleUpdates($updates); |
32 | - $last_update_id = BPT::$update->update_id+1; |
|
33 | - lock::save('getUpdate',$last_update_id); |
|
32 | + $last_update_id = BPT::$update->update_id + 1; |
|
33 | + lock::save('getUpdate', $last_update_id); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | - private static function loadData(): bool|int|string { |
|
37 | + private static function loadData(): bool | int | string { |
|
38 | 38 | if (lock::exist('getUpdate')) { |
39 | 39 | return lock::read('getUpdate'); |
40 | 40 | } |
41 | 41 | self::deleteOldLocks(); |
42 | 42 | telegram::deleteWebhook(); |
43 | - lock::save('getUpdate',0); |
|
43 | + lock::save('getUpdate', 0); |
|
44 | 44 | return 0; |
45 | 45 | } |
46 | 46 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @internal Only for BPT self usage , Don't use it in your source! |
21 | 21 | */ |
22 | - public static function init () { |
|
22 | + public static function init() { |
|
23 | 23 | if (settings::$multi) { |
24 | 24 | multi::init(); |
25 | 25 | } |
@@ -39,24 +39,24 @@ discard block |
||
39 | 39 | lock::deleteIfExist(['BPT-MULTI-EXEC', 'BPT-MULTI-CURL', 'getUpdate', 'getUpdateHook']); |
40 | 40 | } |
41 | 41 | |
42 | - protected static function setWebhook(string $url,string $secret = '') { |
|
42 | + protected static function setWebhook(string $url, string $secret = '') { |
|
43 | 43 | $res = BPT::setWebhook($url, settings::$certificate, max_connections: settings::$max_connection, allowed_updates: settings::$allowed_updates, drop_pending_updates: settings::$skip_old_updates, secret_token: $secret); |
44 | 44 | if (!BPT::$status) { |
45 | - logger::write("There is some problem happened , telegram response : \n".json_encode($res),loggerTypes::ERROR); |
|
46 | - BPT::exit(print_r($res,true)); |
|
45 | + logger::write("There is some problem happened , telegram response : \n".json_encode($res), loggerTypes::ERROR); |
|
46 | + BPT::exit(print_r($res, true)); |
|
47 | 47 | } |
48 | - logger::write('Webhook was set successfully',loggerTypes::INFO); |
|
48 | + logger::write('Webhook was set successfully', loggerTypes::INFO); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | protected static function checkURL() { |
52 | 52 | if (!(isset($_SERVER['SERVER_NAME']) && isset($_SERVER['REQUEST_URI']))) { |
53 | - logger::write('For using webhook receiver , you should open this file in your webserver(by domain)',loggerTypes::ERROR); |
|
53 | + logger::write('For using webhook receiver , you should open this file in your webserver(by domain)', loggerTypes::ERROR); |
|
54 | 54 | throw new bptException('WEBHOOK_NEED_URL'); |
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | private static function setURL(): string { |
59 | - return (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME']; |
|
59 | + return (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | protected static function setCertificate() { |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | self::setCertificate(); |
73 | 73 | $url = self::setURL(); |
74 | 74 | $secret = !empty(settings::$secret) ? settings::$secret : tools::randomString(64); |
75 | - self::setWebhook($url,$secret); |
|
76 | - lock::save('BPT-HOOK',$secret); |
|
75 | + self::setWebhook($url, $secret); |
|
76 | + lock::save('BPT-HOOK', $secret); |
|
77 | 77 | BPT::exit('Done'); |
78 | 78 | } |
79 | 79 | |
80 | 80 | private static function checkSecret() { |
81 | 81 | $secret = lock::read('BPT-HOOK'); |
82 | 82 | if ($secret !== self::getSecret()) { |
83 | - logger::write('This is not webhook set by BPT, webhook will reset',loggerTypes::WARNING); |
|
83 | + logger::write('This is not webhook set by BPT, webhook will reset', loggerTypes::WARNING); |
|
84 | 84 | self::processSetWebhook(); |
85 | 85 | } |
86 | 86 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @return bool |
100 | 100 | */ |
101 | - public static function fastClose (int $timeout = 86400): bool { |
|
101 | + public static function fastClose(int $timeout = 86400): bool { |
|
102 | 102 | if (settings::$multi || !lock::exist('BPT-HOOK') || settings::$receiver !== \BPT\constants\receiver::WEBHOOK) { |
103 | 103 | return false; |
104 | 104 | } |
@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | public static function init () { |
23 | 23 | if (settings::$multi) { |
24 | 24 | multi::init(); |
25 | - } |
|
26 | - else { |
|
25 | + } else { |
|
27 | 26 | if (!lock::exist('BPT-HOOK')) { |
28 | 27 | self::processSetWebhook(); |
29 | 28 | } |
@@ -108,11 +107,9 @@ discard block |
||
108 | 107 | ignore_user_abort(true); |
109 | 108 | if (function_exists('fastcgi_finish_request')) { |
110 | 109 | fastcgi_finish_request(); |
111 | - } |
|
112 | - elseif (function_exists('litespeed_finish_request')) { |
|
110 | + } elseif (function_exists('litespeed_finish_request')) { |
|
113 | 111 | litespeed_finish_request(); |
114 | - } |
|
115 | - else { |
|
112 | + } else { |
|
116 | 113 | return false; |
117 | 114 | } |
118 | 115 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use BPT\settings; |
6 | 6 | |
7 | 7 | class pay { |
8 | - public static function init (): void { |
|
8 | + public static function init(): void { |
|
9 | 9 | if (isset(settings::$pay['crypto'])) { |
10 | 10 | crypto::init(); |
11 | 11 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | private static CurlHandle $session; |
23 | 23 | |
24 | - public static function init (string $api_key = '', string $ipn_secret = ''): void { |
|
24 | + public static function init(string $api_key = '', string $ipn_secret = ''): void { |
|
25 | 25 | self::$api_key = settings::$pay['crypto']['api_key'] ?? $api_key; |
26 | 26 | self::$ipn_secret = settings::$pay['crypto']['ipn_secret'] ?? $ipn_secret; |
27 | 27 | self::$session = curl_init(); |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | curl_setopt(self::$session, CURLOPT_SSL_VERIFYPEER, 1); |
30 | 30 | curl_setopt(self::$session, CURLOPT_SSL_VERIFYHOST, 2); |
31 | 31 | curl_setopt(self::$session, CURLOPT_HTTPHEADER, [ |
32 | - 'X-API-KEY: ' . self::$api_key, |
|
32 | + 'X-API-KEY: '.self::$api_key, |
|
33 | 33 | 'Content-Type: application/json' |
34 | 34 | ]); |
35 | 35 | } |
36 | 36 | |
37 | - private static function execute (string $method, string $endpoint, string|array $data = '') { |
|
37 | + private static function execute(string $method, string $endpoint, string | array $data = '') { |
|
38 | 38 | if (is_array($data)) { |
39 | 39 | foreach ($data as $key => $value) { |
40 | 40 | if (empty($value)) { |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | |
48 | 48 | switch ($method) { |
49 | 49 | case 'GET': |
50 | - curl_setopt($session, CURLOPT_URL, self::API_BASE . $endpoint . !empty($data) && is_array($data) ? ('?' . http_build_query($data)) : ''); |
|
50 | + curl_setopt($session, CURLOPT_URL, self::API_BASE.$endpoint.!empty($data) && is_array($data) ? ('?'.http_build_query($data)) : ''); |
|
51 | 51 | break; |
52 | 52 | case 'POST': |
53 | 53 | curl_setopt($session, CURLOPT_POST, true); |
54 | 54 | curl_setopt($session, CURLOPT_POSTFIELDS, json_encode($data)); |
55 | - curl_setopt($session, CURLOPT_URL, self::API_BASE . $endpoint); |
|
55 | + curl_setopt($session, CURLOPT_URL, self::API_BASE.$endpoint); |
|
56 | 56 | break; |
57 | 57 | default: |
58 | 58 | return false; |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | return json_decode(curl_exec($session)); |
61 | 61 | } |
62 | 62 | |
63 | - public static function status (): bool { |
|
63 | + public static function status(): bool { |
|
64 | 64 | return self::execute('GET', 'status')->message === 'OK'; |
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
68 | 68 | * @return estimatePriceInterface|mixed |
69 | 69 | */ |
70 | - public static function getEstimatePrice (int|float $amount, string $currency_from, string $currency_to) { |
|
70 | + public static function getEstimatePrice(int | float $amount, string $currency_from, string $currency_to) { |
|
71 | 71 | return self::execute('GET', 'estimate', [ |
72 | 72 | 'amount' => $amount, |
73 | 73 | 'currency_from' => $currency_from, |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * @return invoicePaymentInterface|mixed |
80 | 80 | */ |
81 | - public static function createPayment (int|float $price_amount, string $price_currency, string $pay_currency, int|float $pay_amount = null, string $ipn_callback_url = null, string $order_id = null, string $order_description = null, string $purchase_id = null, string $payout_address = null, string $payout_currency = null, string $payout_extra_id = null, bool $fixed_rate = null) { |
|
81 | + public static function createPayment(int | float $price_amount, string $price_currency, string $pay_currency, int | float $pay_amount = null, string $ipn_callback_url = null, string $order_id = null, string $order_description = null, string $purchase_id = null, string $payout_address = null, string $payout_currency = null, string $payout_extra_id = null, bool $fixed_rate = null) { |
|
82 | 82 | return self::execute('POST', 'payment', [ |
83 | 83 | 'price_amount' => $price_amount, |
84 | 84 | 'price_currency' => $price_currency, |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * @return invoicePaymentInterface|mixed |
100 | 100 | */ |
101 | - public static function createInvoicePayment (string $iid, string $pay_currency, string $purchase_id = null, string $order_description = null, string $customer_email = null, string $payout_address = null, string $payout_extra_id = null, string $payout_currency = null) { |
|
101 | + public static function createInvoicePayment(string $iid, string $pay_currency, string $purchase_id = null, string $order_description = null, string $customer_email = null, string $payout_address = null, string $payout_extra_id = null, string $payout_currency = null) { |
|
102 | 102 | return self::execute('POST', 'invoice', [ |
103 | 103 | 'iid' => $iid, |
104 | 104 | 'pay_currency' => $pay_currency, |
@@ -114,18 +114,18 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @return estimateUpdateInterface|mixed |
116 | 116 | */ |
117 | - public static function updateEstimatePrice (int $paymentID) { |
|
118 | - return self::execute('POST', 'payment/' . $paymentID . '/update-merchant-estimate'); |
|
117 | + public static function updateEstimatePrice(int $paymentID) { |
|
118 | + return self::execute('POST', 'payment/'.$paymentID.'/update-merchant-estimate'); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
122 | 122 | * @return paymentInterface|mixed |
123 | 123 | */ |
124 | - public static function getPaymentStatus (int $paymentID) { |
|
125 | - return self::execute('GET', 'payment/' . $paymentID); |
|
124 | + public static function getPaymentStatus(int $paymentID) { |
|
125 | + return self::execute('GET', 'payment/'.$paymentID); |
|
126 | 126 | } |
127 | 127 | |
128 | - public static function getMinimumPaymentAmount (string $currency_from, string $currency_to): float { |
|
128 | + public static function getMinimumPaymentAmount(string $currency_from, string $currency_to): float { |
|
129 | 129 | return self::execute('GET', 'min-amount', [ |
130 | 130 | 'currency_from' => $currency_from, |
131 | 131 | 'currency_to' => $currency_to |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | /** |
136 | 136 | * @return invoiceResponseInterface|mixed |
137 | 137 | */ |
138 | - public static function createInvoice (int|float $price_amount, string $price_currency, string $pay_currency, int|float $pay_amount = null, string $ipn_callback_url = null, string $order_id = null, string $order_description = null, string $success_url = null, string $cancel_url = null) { |
|
138 | + public static function createInvoice(int | float $price_amount, string $price_currency, string $pay_currency, int | float $pay_amount = null, string $ipn_callback_url = null, string $order_id = null, string $order_description = null, string $success_url = null, string $cancel_url = null) { |
|
139 | 139 | return self::execute('POST', 'invoice', [ |
140 | 140 | 'price_amount' => $price_amount, |
141 | 141 | 'price_currency' => $price_currency, |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | ]); |
150 | 150 | } |
151 | 151 | |
152 | - public static function getCurrencies (): array { |
|
152 | + public static function getCurrencies(): array { |
|
153 | 153 | return self::execute('GET', 'currencies')->currencies; |
154 | 154 | } |
155 | 155 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | return tools::remoteIP() === '144.76.201.30'; |
158 | 158 | } |
159 | 159 | |
160 | - public static function isIPNRequestValid (): bool { |
|
160 | + public static function isIPNRequestValid(): bool { |
|
161 | 161 | if (empty($_SERVER['HTTP_X_NOWPAYMENTS_SIG'])) { |
162 | 162 | return false; |
163 | 163 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | /** |
178 | 178 | * @return ipnDataInterface|mixed |
179 | 179 | */ |
180 | - public static function getIPN () { |
|
180 | + public static function getIPN() { |
|
181 | 181 | if (!self::isIPNRequestValid()) { |
182 | 182 | return false; |
183 | 183 | } |
@@ -16,20 +16,20 @@ discard block |
||
16 | 16 | |
17 | 17 | private static CurlHandle $session; |
18 | 18 | |
19 | - public static function init (string $api_key = '', bool $sandbox = false): void { |
|
19 | + public static function init(string $api_key = '', bool $sandbox = false): void { |
|
20 | 20 | self::$session = curl_init(); |
21 | 21 | curl_setopt(self::$session, CURLOPT_RETURNTRANSFER, true); |
22 | 22 | curl_setopt(self::$session, CURLOPT_SSL_VERIFYPEER, 1); |
23 | 23 | curl_setopt(self::$session, CURLOPT_SSL_VERIFYHOST, 2); |
24 | 24 | curl_setopt(self::$session, CURLOPT_HTTPHEADER, [ |
25 | 25 | 'Content-Type: application/json', |
26 | - 'X-API-KEY: ' . settings::$pay['idpay']['api_key'] ?? $api_key, |
|
27 | - 'X-SANDBOX: ' . (int) (settings::$pay['idpay']['sandbox'] ?? $sandbox), |
|
26 | + 'X-API-KEY: '.settings::$pay['idpay']['api_key'] ?? $api_key, |
|
27 | + 'X-SANDBOX: '.(int) (settings::$pay['idpay']['sandbox'] ?? $sandbox), |
|
28 | 28 | ]); |
29 | 29 | curl_setopt(self::$session, CURLOPT_POST, true); |
30 | 30 | } |
31 | 31 | |
32 | - private static function execute (string $endpoint, array $params) { |
|
32 | + private static function execute(string $endpoint, array $params) { |
|
33 | 33 | foreach ($params as $key => $value) { |
34 | 34 | if (empty($value)) { |
35 | 35 | unset($params[$key]); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $session = self::$session; |
40 | 40 | |
41 | 41 | curl_setopt($session, CURLOPT_POSTFIELDS, json_encode($params)); |
42 | - curl_setopt($session, CURLOPT_URL, self::API_BASE . $endpoint); |
|
42 | + curl_setopt($session, CURLOPT_URL, self::API_BASE.$endpoint); |
|
43 | 43 | |
44 | 44 | return json_decode(curl_exec($session)); |
45 | 45 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * @return paymentCreateInterface|errorInterface|object|bool |
49 | 49 | */ |
50 | - public static function createPayment (string $order_id, int $amount, string $name = '', string $phone = '', string $mail = '', string $desc = '', string $callback = ''): object|bool { |
|
50 | + public static function createPayment(string $order_id, int $amount, string $name = '', string $phone = '', string $mail = '', string $desc = '', string $callback = ''): object | bool { |
|
51 | 51 | return self::execute('payment', [ |
52 | 52 | 'order_id' => $order_id, |
53 | 53 | 'amount' => $amount, |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * @return paymentInterface|errorInterface|object|bool |
64 | 64 | */ |
65 | - public static function paymentDetail (string $id, string $order_id): object { |
|
65 | + public static function paymentDetail(string $id, string $order_id): object { |
|
66 | 66 | return self::execute('payment/inquiry', [ |
67 | 67 | 'order_id' => $order_id, |
68 | 68 | 'id' => $id |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @return paymentInterface|errorInterface|object|bool |
74 | 74 | */ |
75 | - public static function paymentConfirm (string $id, string $order_id): object { |
|
75 | + public static function paymentConfirm(string $id, string $order_id): object { |
|
76 | 76 | return self::execute('payment/verify', [ |
77 | 77 | 'order_id' => $order_id, |
78 | 78 | 'id' => $id |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * @return paymentListInterface|errorInterface|object|bool |
84 | 84 | */ |
85 | - public static function paymentList (int $page = 0, int $page_size = 25): object { |
|
85 | + public static function paymentList(int $page = 0, int $page_size = 25): object { |
|
86 | 86 | return self::execute('payment/transactions', [ |
87 | 87 | 'page' => $page, |
88 | 88 | 'page_size' => $page_size |
89 | 89 | ]); |
90 | 90 | } |
91 | 91 | |
92 | - public static function processCallback (): bool|int { |
|
92 | + public static function processCallback(): bool | int { |
|
93 | 93 | if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
94 | 94 | $response = $_POST; |
95 | 95 | } |
@@ -92,11 +92,9 @@ |
||
92 | 92 | public static function processCallback (): bool|int { |
93 | 93 | if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
94 | 94 | $response = $_POST; |
95 | - } |
|
96 | - elseif ($_SERVER['REQUEST_METHOD'] === 'GET') { |
|
95 | + } elseif ($_SERVER['REQUEST_METHOD'] === 'GET') { |
|
97 | 96 | $response = $_GET; |
98 | - } |
|
99 | - else { |
|
97 | + } else { |
|
100 | 98 | return false; |
101 | 99 | } |
102 | 100 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | private static CurlHandle $session; |
27 | 27 | |
28 | - public static function init (string $merchant_id = '', bool $sandbox = false, bool $zarin_gate = false): void { |
|
28 | + public static function init(string $merchant_id = '', bool $sandbox = false, bool $zarin_gate = false): void { |
|
29 | 29 | self::$sandbox = settings::$pay['zarinpal']['sandbox'] ?? $sandbox; |
30 | 30 | self::$zarin_gate = settings::$pay['zarinpal']['zarin_gate'] ?? settings::$pay['zarinpal']['zaringate'] ?? $zarin_gate; |
31 | 31 | self::$merchant_id = settings::$pay['zarinpal']['merchant_id'] ?? $merchant_id; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | curl_setopt(self::$session, CURLOPT_POST, true); |
41 | 41 | } |
42 | 42 | |
43 | - private static function getUrl (string $endpoint, bool $pay = false): string { |
|
43 | + private static function getUrl(string $endpoint, bool $pay = false): string { |
|
44 | 44 | if ($pay) { |
45 | 45 | $url = self::$sandbox ? self::SANDBOX_PAY_BASE : self::PAY_BASE; |
46 | 46 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | return $url; |
55 | 55 | } |
56 | 56 | |
57 | - private static function execute (string $endpoint, array $params = []): object { |
|
57 | + private static function execute(string $endpoint, array $params = []): object { |
|
58 | 58 | foreach ($params as $key => $value) { |
59 | 59 | if (empty($value)) { |
60 | 60 | unset($params[$key]); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * @return object|requestInterface |
90 | 90 | */ |
91 | - public static function request (int $amount, string $description, string $callback_url, array $metadata = [], string $mobile = '', string $email = '', array $wages = [], int $card_pan = null, string $currency = ''): object { |
|
91 | + public static function request(int $amount, string $description, string $callback_url, array $metadata = [], string $mobile = '', string $email = '', array $wages = [], int $card_pan = null, string $currency = ''): object { |
|
92 | 92 | return self::execute('/request.json', [ |
93 | 93 | 'amount' => $amount, |
94 | 94 | 'description' => $description, |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | ]); |
103 | 103 | } |
104 | 104 | |
105 | - public static function payURL (string|array $authority): bool|string { |
|
105 | + public static function payURL(string | array $authority): bool | string { |
|
106 | 106 | if (is_array($authority)) { |
107 | 107 | if (!isset($authority->authority)) { |
108 | 108 | return false; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | /** |
116 | 116 | * @return object|verifyInterface |
117 | 117 | */ |
118 | - public static function verify (int $amount, string $authority): object { |
|
118 | + public static function verify(int $amount, string $authority): object { |
|
119 | 119 | return self::execute('/verify.json', [ |
120 | 120 | 'amount' => $amount, |
121 | 121 | 'authority' => $authority |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * @return object|unverifiedInterface |
127 | 127 | */ |
128 | - public static function unVerified (): object { |
|
128 | + public static function unVerified(): object { |
|
129 | 129 | return self::execute('/unVerified.json'); |
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
133 | 133 | * @return object|refundInterface |
134 | 134 | */ |
135 | - public static function refund (string $authorization, string $authority): object { |
|
135 | + public static function refund(string $authorization, string $authority): object { |
|
136 | 136 | return self::execute('/refund.json', [ |
137 | 137 | 'authorization' => $authorization, |
138 | 138 | 'authority' => $authority |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | #[NoReturn] |
143 | - public static function redirect (string $url): void { |
|
144 | - @header('Location: ' . $url); |
|
143 | + public static function redirect(string $url): void { |
|
144 | + @header('Location: '.$url); |
|
145 | 145 | die("<meta http-equiv='refresh' content='0; url=$url' /><script>window.location.href = '$url';</script>"); |
146 | 146 | } |
147 | 147 | |
148 | - public static function processCallback (int $amount): object|bool|int { |
|
148 | + public static function processCallback(int $amount): object | bool | int { |
|
149 | 149 | if (!isset($_GET['Authority']) || !isset($_GET['Status'])) { |
150 | 150 | return false; |
151 | 151 | } |
@@ -43,8 +43,7 @@ |
||
43 | 43 | private static function getUrl (string $endpoint, bool $pay = false): string { |
44 | 44 | if ($pay) { |
45 | 45 | $url = self::$sandbox ? self::SANDBOX_PAY_BASE : self::PAY_BASE; |
46 | - } |
|
47 | - else { |
|
46 | + } else { |
|
48 | 47 | $url = self::$sandbox ? self::SANDBOX_API_BASE : self::API_BASE; |
49 | 48 | } |
50 | 49 | $url .= $endpoint; |