Complex classes like Request often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Request, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
19 | class Request |
||
20 | { |
||
21 | /** |
||
22 | * Telegram object |
||
23 | * |
||
24 | * @var \Longman\TelegramBot\Telegram |
||
25 | */ |
||
26 | private static $telegram; |
||
27 | |||
28 | /** |
||
29 | * URI of the Telegram API |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | private static $api_base_uri = 'https://api.telegram.org'; |
||
34 | |||
35 | /** |
||
36 | * Guzzle Client object |
||
37 | * |
||
38 | * @var \GuzzleHttp\Client |
||
39 | */ |
||
40 | private static $client; |
||
41 | |||
42 | /** |
||
43 | * Input value of the request |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | private static $input; |
||
48 | |||
49 | /** |
||
50 | * Request limiter |
||
51 | * |
||
52 | * @var boolean |
||
53 | */ |
||
54 | private static $limiter_enabled; |
||
55 | |||
56 | /** |
||
57 | * Request limiter's interval between checks |
||
58 | * |
||
59 | * @var boolean |
||
60 | */ |
||
61 | private static $limiter_interval; |
||
62 | |||
63 | /** |
||
64 | * Available actions to send |
||
65 | * |
||
66 | * @var array |
||
67 | */ |
||
68 | private static $actions = [ |
||
69 | 'getUpdates', |
||
70 | 'setWebhook', |
||
71 | 'deleteWebhook', |
||
72 | 'getMe', |
||
73 | 'sendMessage', |
||
74 | 'forwardMessage', |
||
75 | 'sendPhoto', |
||
76 | 'sendAudio', |
||
77 | 'sendDocument', |
||
78 | 'sendSticker', |
||
79 | 'sendVideo', |
||
80 | 'sendVoice', |
||
81 | 'sendLocation', |
||
82 | 'sendVenue', |
||
83 | 'sendContact', |
||
84 | 'sendChatAction', |
||
85 | 'getUserProfilePhotos', |
||
86 | 'getFile', |
||
87 | 'kickChatMember', |
||
88 | 'leaveChat', |
||
89 | 'unbanChatMember', |
||
90 | 'getChat', |
||
91 | 'getChatAdministrators', |
||
92 | 'getChatMember', |
||
93 | 'getChatMembersCount', |
||
94 | 'answerCallbackQuery', |
||
95 | 'answerInlineQuery', |
||
96 | 'editMessageText', |
||
97 | 'editMessageCaption', |
||
98 | 'editMessageReplyMarkup', |
||
99 | 'getWebhookInfo', |
||
100 | 'deleteMessage', |
||
101 | ]; |
||
102 | |||
103 | /** |
||
104 | * Initialize |
||
105 | * |
||
106 | * @param \Longman\TelegramBot\Telegram $telegram |
||
107 | * |
||
108 | * @throws TelegramException |
||
109 | */ |
||
110 | 30 | public static function initialize(Telegram $telegram) |
|
119 | |||
120 | /** |
||
121 | * Set a custom Guzzle HTTP Client object |
||
122 | * |
||
123 | * @param Client $client |
||
124 | * |
||
125 | * @throws TelegramException |
||
126 | */ |
||
127 | 30 | public static function setClient(Client $client) |
|
135 | |||
136 | /** |
||
137 | * Set input from custom input or stdin and return it |
||
138 | * |
||
139 | * @return string |
||
140 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
141 | */ |
||
142 | public static function getInput() |
||
160 | |||
161 | /** |
||
162 | * Generate general fake server response |
||
163 | * |
||
164 | * @param array $data Data to add to fake response |
||
165 | * |
||
166 | * @return array Fake response data |
||
167 | */ |
||
168 | 1 | public static function generateGeneralFakeServerResponse(array $data = []) |
|
198 | |||
199 | /** |
||
200 | * Properly set up the request params |
||
201 | * |
||
202 | * If any item of the array is a resource, reformat it to a multipart request. |
||
203 | * Else, just return the passed data as form params. |
||
204 | * |
||
205 | * @param array $data |
||
206 | * |
||
207 | * @return array |
||
208 | */ |
||
209 | private static function setUpRequestParams(array $data) |
||
230 | |||
231 | /** |
||
232 | * Execute HTTP Request |
||
233 | * |
||
234 | * @param string $action Action to execute |
||
235 | * @param array $data Data to attach to the execution |
||
236 | * |
||
237 | * @return string Result of the HTTP Request |
||
238 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
239 | */ |
||
240 | public static function execute($action, array $data = []) |
||
271 | |||
272 | /** |
||
273 | * Download file |
||
274 | * |
||
275 | * @param \Longman\TelegramBot\Entities\File $file |
||
276 | * |
||
277 | * @return boolean |
||
278 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
279 | */ |
||
280 | public static function downloadFile(File $file) |
||
312 | |||
313 | /** |
||
314 | * Encode file |
||
315 | * |
||
316 | * @param string $file |
||
317 | * |
||
318 | * @return resource |
||
319 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
320 | */ |
||
321 | protected static function encodeFile($file) |
||
330 | |||
331 | /** |
||
332 | * Send command |
||
333 | * |
||
334 | * @todo Fake response doesn't need json encoding? |
||
335 | * |
||
336 | * @param string $action |
||
337 | * @param array $data |
||
338 | * |
||
339 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
340 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
341 | */ |
||
342 | public static function send($action, array $data = []) |
||
366 | |||
367 | /** |
||
368 | * Make sure the data isn't empty, else throw an exception |
||
369 | * |
||
370 | * @param array $data |
||
371 | * |
||
372 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
373 | */ |
||
374 | private static function ensureNonEmptyData(array $data) |
||
380 | |||
381 | /** |
||
382 | * Make sure the action is valid, else throw an exception |
||
383 | * |
||
384 | * @param string $action |
||
385 | * |
||
386 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
387 | */ |
||
388 | private static function ensureValidAction($action) |
||
394 | |||
395 | /** |
||
396 | * Assign an encoded file to a data array |
||
397 | * |
||
398 | * @param array $data |
||
399 | * @param string $field |
||
400 | * @param string $file |
||
401 | * |
||
402 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
403 | */ |
||
404 | private static function assignEncodedFile(&$data, $field, $file) |
||
410 | |||
411 | /** |
||
412 | * Returns basic information about the bot in form of a User object |
||
413 | * |
||
414 | * @link https://core.telegram.org/bots/api#getme |
||
415 | * |
||
416 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
417 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
418 | */ |
||
419 | public static function getMe() |
||
425 | |||
426 | /** |
||
427 | * Use this method to send text messages. On success, the sent Message is returned |
||
428 | * |
||
429 | * @link https://core.telegram.org/bots/api#sendmessage |
||
430 | * |
||
431 | * @param array $data |
||
432 | * |
||
433 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
434 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
435 | */ |
||
436 | public static function sendMessage(array $data) |
||
451 | |||
452 | /** |
||
453 | * Use this method to forward messages of any kind. On success, the sent Message is returned |
||
454 | * |
||
455 | * @link https://core.telegram.org/bots/api#forwardmessage |
||
456 | * |
||
457 | * @param array $data |
||
458 | * |
||
459 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
460 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
461 | */ |
||
462 | public static function forwardMessage(array $data) |
||
466 | |||
467 | /** |
||
468 | * Use this method to send photos. On success, the sent Message is returned |
||
469 | * |
||
470 | * @link https://core.telegram.org/bots/api#sendphoto |
||
471 | * |
||
472 | * @param array $data |
||
473 | * @param string $file |
||
474 | * |
||
475 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
476 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
477 | */ |
||
478 | public static function sendPhoto(array $data, $file = null) |
||
484 | |||
485 | /** |
||
486 | * Use this method to send audio files |
||
487 | * |
||
488 | * Your audio must be in the .mp3 format. On success, the sent Message is returned. |
||
489 | * Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. |
||
490 | * For sending voice messages, use the sendVoice method instead. |
||
491 | * |
||
492 | * @link https://core.telegram.org/bots/api#sendaudio |
||
493 | * |
||
494 | * @param array $data |
||
495 | * @param string $file |
||
496 | * |
||
497 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
498 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
499 | */ |
||
500 | public static function sendAudio(array $data, $file = null) |
||
506 | |||
507 | /** |
||
508 | * Use this method to send general files. On success, the sent Message is returned. |
||
509 | * |
||
510 | * Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. |
||
511 | * |
||
512 | * @link https://core.telegram.org/bots/api#senddocument |
||
513 | * |
||
514 | * @param array $data |
||
515 | * @param string $file |
||
516 | * |
||
517 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
518 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
519 | */ |
||
520 | public static function sendDocument(array $data, $file = null) |
||
526 | |||
527 | /** |
||
528 | * Use this method to send .webp stickers. On success, the sent Message is returned. |
||
529 | * |
||
530 | * @link https://core.telegram.org/bots/api#sendsticker |
||
531 | * |
||
532 | * @param array $data |
||
533 | * @param string $file |
||
534 | * |
||
535 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
536 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
537 | */ |
||
538 | public static function sendSticker(array $data, $file = null) |
||
544 | |||
545 | /** |
||
546 | * Use this method to send video files. On success, the sent Message is returned. |
||
547 | * |
||
548 | * Telegram clients support mp4 videos (other formats may be sent as Document). |
||
549 | * Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. |
||
550 | * |
||
551 | * @link https://core.telegram.org/bots/api#sendvideo |
||
552 | * |
||
553 | * @param array $data |
||
554 | * @param string $file |
||
555 | * |
||
556 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
557 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
558 | */ |
||
559 | public static function sendVideo(array $data, $file = null) |
||
565 | |||
566 | /** |
||
567 | * Use this method to send audio files. On success, the sent Message is returned. |
||
568 | * |
||
569 | * Telegram clients will display the file as a playable voice message. |
||
570 | * For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). |
||
571 | * Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. |
||
572 | * |
||
573 | * @link https://core.telegram.org/bots/api#sendvoice |
||
574 | * |
||
575 | * @param array $data |
||
576 | * @param string $file |
||
577 | * |
||
578 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
579 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
580 | */ |
||
581 | public static function sendVoice(array $data, $file = null) |
||
587 | |||
588 | /** |
||
589 | * Use this method to send point on the map. On success, the sent Message is returned. |
||
590 | * |
||
591 | * @link https://core.telegram.org/bots/api#sendlocation |
||
592 | * |
||
593 | * @param array $data |
||
594 | * |
||
595 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
596 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
597 | */ |
||
598 | public static function sendLocation(array $data) |
||
602 | |||
603 | /** |
||
604 | * Use this method to send information about a venue. On success, the sent Message is returned. |
||
605 | * |
||
606 | * @link https://core.telegram.org/bots/api#sendvenue |
||
607 | * |
||
608 | * @param array $data |
||
609 | * |
||
610 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
611 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
612 | */ |
||
613 | public static function sendVenue(array $data) |
||
617 | |||
618 | /** |
||
619 | * Use this method to send phone contacts. On success, the sent Message is returned. |
||
620 | * |
||
621 | * @link https://core.telegram.org/bots/api#sendcontact |
||
622 | * |
||
623 | * @param array $data |
||
624 | * |
||
625 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
626 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
627 | */ |
||
628 | public static function sendContact(array $data) |
||
632 | |||
633 | /** |
||
634 | * Use this method when you need to tell the user that something is happening on the bot's side. |
||
635 | * |
||
636 | * The status is set for 5 seconds or less. |
||
637 | * (when a message arrives from your bot, Telegram clients clear its typing status) |
||
638 | * |
||
639 | * @link https://core.telegram.org/bots/api#sendchataction |
||
640 | * |
||
641 | * @param array $data |
||
642 | * |
||
643 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
644 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
645 | */ |
||
646 | public static function sendChatAction(array $data) |
||
650 | |||
651 | /** |
||
652 | * Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. |
||
653 | * |
||
654 | * @param array $data |
||
655 | * |
||
656 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
657 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
658 | */ |
||
659 | public static function getUserProfilePhotos(array $data) |
||
663 | |||
664 | /** |
||
665 | * Use this method to get basic info about a file and prepare it for downloading. On success, a File object is returned. |
||
666 | * |
||
667 | * For the moment, bots can download files of up to 20MB in size. |
||
668 | * The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, |
||
669 | * where <file_path> is taken from the response. |
||
670 | * It is guaranteed that the link will be valid for at least 1 hour. |
||
671 | * When the link expires, a new one can be requested by calling getFile again. |
||
672 | * |
||
673 | * @link https://core.telegram.org/bots/api#getfile |
||
674 | * |
||
675 | * @param array $data |
||
676 | * |
||
677 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
678 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
679 | */ |
||
680 | public static function getFile(array $data) |
||
684 | |||
685 | /** |
||
686 | * Use this method to kick a user from a group or a supergroup. Returns True on success. |
||
687 | * |
||
688 | * In the case of supergroups, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. |
||
689 | * The bot must be an administrator in the group for this to work. |
||
690 | * |
||
691 | * @link https://core.telegram.org/bots/api#kickchatmember |
||
692 | * |
||
693 | * @param array $data |
||
694 | * |
||
695 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
696 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
697 | */ |
||
698 | public static function kickChatMember(array $data) |
||
702 | |||
703 | /** |
||
704 | * Use this method for your bot to leave a group, supergroup or channel. Returns True on success. |
||
705 | * |
||
706 | * @link https://core.telegram.org/bots/api#leavechat |
||
707 | * |
||
708 | * @param array $data |
||
709 | * |
||
710 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
711 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
712 | */ |
||
713 | public static function leaveChat(array $data) |
||
717 | |||
718 | /** |
||
719 | * Use this method to unban a previously kicked user in a supergroup. Returns True on success. |
||
720 | * |
||
721 | * The user will not return to the group automatically, but will be able to join via link, etc. |
||
722 | * The bot must be an administrator in the group for this to work. |
||
723 | * |
||
724 | * @link https://core.telegram.org/bots/api#unbanchatmember |
||
725 | * |
||
726 | * @param array $data |
||
727 | * |
||
728 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
729 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
730 | */ |
||
731 | public static function unbanChatMember(array $data) |
||
735 | |||
736 | /** |
||
737 | * Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success. |
||
738 | * |
||
739 | * @todo add get response in ServerResponse.php? |
||
740 | * |
||
741 | * @link https://core.telegram.org/bots/api#getchat |
||
742 | * |
||
743 | * @param array $data |
||
744 | * |
||
745 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
746 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
747 | */ |
||
748 | public static function getChat(array $data) |
||
752 | |||
753 | /** |
||
754 | * Use this method to get a list of administrators in a chat. |
||
755 | * |
||
756 | * On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. |
||
757 | * If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. |
||
758 | * |
||
759 | * @todo add get response in ServerResponse.php? |
||
760 | * |
||
761 | * @link https://core.telegram.org/bots/api#getchatadministrators |
||
762 | * |
||
763 | * @param array $data |
||
764 | * |
||
765 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
766 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
767 | */ |
||
768 | public static function getChatAdministrators(array $data) |
||
772 | |||
773 | /** |
||
774 | * Use this method to get the number of members in a chat. Returns Int on success. |
||
775 | * |
||
776 | * @todo add get response in ServerResponse.php? |
||
777 | * |
||
778 | * @link https://core.telegram.org/bots/api#getchatmemberscount |
||
779 | * |
||
780 | * @param array $data |
||
781 | * |
||
782 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
783 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
784 | */ |
||
785 | public static function getChatMembersCount(array $data) |
||
789 | |||
790 | /** |
||
791 | * Use this method to get information about a member of a chat. Returns a ChatMember object on success. |
||
792 | * |
||
793 | * @todo add get response in ServerResponse.php? |
||
794 | * |
||
795 | * @link https://core.telegram.org/bots/api#getchatmember |
||
796 | * |
||
797 | * @param array $data |
||
798 | * |
||
799 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
800 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
801 | */ |
||
802 | public static function getChatMember(array $data) |
||
806 | |||
807 | /** |
||
808 | * Use this method to send answers to callback queries sent from inline keyboards. On success, True is returned. |
||
809 | * |
||
810 | * The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. |
||
811 | * |
||
812 | * @link https://core.telegram.org/bots/api#answercallbackquery |
||
813 | * |
||
814 | * @param array $data |
||
815 | * |
||
816 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
817 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
818 | */ |
||
819 | public static function answerCallbackQuery(array $data) |
||
823 | |||
824 | /** |
||
825 | * Get updates |
||
826 | * |
||
827 | * @link https://core.telegram.org/bots/api#getupdates |
||
828 | * |
||
829 | * @param array $data |
||
830 | * |
||
831 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
832 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
833 | */ |
||
834 | public static function getUpdates(array $data) |
||
838 | |||
839 | /** |
||
840 | * Set webhook |
||
841 | * |
||
842 | * @link https://core.telegram.org/bots/api#setwebhook |
||
843 | * |
||
844 | * @param string $url |
||
845 | * @param array $data Optional parameters. |
||
846 | * |
||
847 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
848 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
849 | */ |
||
850 | public static function setWebhook($url = '', array $data = []) |
||
865 | |||
866 | /** |
||
867 | * Delete webhook |
||
868 | * |
||
869 | * @link https://core.telegram.org/bots/api#deletewebhook |
||
870 | * |
||
871 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
872 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
873 | */ |
||
874 | public static function deleteWebhook() |
||
879 | |||
880 | /** |
||
881 | * Use this method to edit text and game messages sent by the bot or via the bot (for inline bots). |
||
882 | * |
||
883 | * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. |
||
884 | * |
||
885 | * @link https://core.telegram.org/bots/api#editmessagetext |
||
886 | * |
||
887 | * @param array $data |
||
888 | * |
||
889 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
890 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
891 | */ |
||
892 | public static function editMessageText(array $data) |
||
896 | |||
897 | /** |
||
898 | * Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). |
||
899 | * |
||
900 | * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. |
||
901 | * |
||
902 | * @link https://core.telegram.org/bots/api#editmessagecaption |
||
903 | * |
||
904 | * @param array $data |
||
905 | * |
||
906 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
907 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
908 | */ |
||
909 | public static function editMessageCaption(array $data) |
||
913 | |||
914 | /** |
||
915 | * Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). |
||
916 | * |
||
917 | * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. |
||
918 | * |
||
919 | * @link https://core.telegram.org/bots/api#editmessagereplymarkup |
||
920 | * |
||
921 | * @param array $data |
||
922 | * |
||
923 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
924 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
925 | */ |
||
926 | public static function editMessageReplyMarkup(array $data) |
||
930 | |||
931 | /** |
||
932 | * Use this method to send answers to an inline query. On success, True is returned. |
||
933 | * |
||
934 | * No more than 50 results per query are allowed. |
||
935 | * |
||
936 | * @link https://core.telegram.org/bots/api#answerinlinequery |
||
937 | * |
||
938 | * @param array $data |
||
939 | * |
||
940 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
941 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
942 | */ |
||
943 | public static function answerInlineQuery(array $data) |
||
947 | |||
948 | /** |
||
949 | * Return an empty Server Response |
||
950 | * |
||
951 | * No request to telegram are sent, this function is used in commands that |
||
952 | * don't need to fire a message after execution |
||
953 | * |
||
954 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
955 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
956 | */ |
||
957 | public static function emptyResponse() |
||
961 | |||
962 | /** |
||
963 | * Send message to all active chats |
||
964 | * |
||
965 | * @param string $callback_function |
||
966 | * @param array $data |
||
967 | * @param array $select_chats_params |
||
968 | * |
||
969 | * @return array |
||
970 | * @throws TelegramException |
||
971 | */ |
||
972 | public static function sendToActiveChats( |
||
994 | |||
995 | /** |
||
996 | * Use this method to get current webhook status. |
||
997 | * |
||
998 | * @link https://core.telegram.org/bots/api#getwebhookinfo |
||
999 | * |
||
1000 | * @return Entities\ServerResponse |
||
1001 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
1002 | */ |
||
1003 | public static function getWebhookInfo() |
||
1008 | |||
1009 | /** |
||
1010 | * Enable request limiter |
||
1011 | * |
||
1012 | * @param boolean $value |
||
1013 | * @param array $options |
||
1014 | * |
||
1015 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
1016 | */ |
||
1017 | public static function setLimiter($value = true, array $options = []) |
||
1034 | |||
1035 | /** |
||
1036 | * This functions delays API requests to prevent reaching Telegram API limits |
||
1037 | * Can be disabled while in execution by 'Request::setLimiter(false)' |
||
1038 | * |
||
1039 | * @link https://core.telegram.org/bots/faq#my-bot-is-hitting-limits-how-do-i-avoid-this |
||
1040 | * |
||
1041 | * @param string $action |
||
1042 | * @param array $data |
||
1043 | * |
||
1044 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
1045 | */ |
||
1046 | private static function limitTelegramRequests($action, array $data = []) |
||
1095 | |||
1096 | /** |
||
1097 | * Use this method to delete either bot's messages or messages of other users if the bot is admin of the group. |
||
1098 | * |
||
1099 | * On success, true is returned. |
||
1100 | * |
||
1101 | * @link https://core.telegram.org/bots/api#deletemessage |
||
1102 | * |
||
1103 | * @param array $data |
||
1104 | * |
||
1105 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
1106 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
1107 | */ |
||
1108 | public static function deleteMessage(array $data) |
||
1112 | |||
1113 | /** |
||
1114 | * Use this method to send video notes. On success, the sent Message is returned. |
||
1115 | * |
||
1116 | * @link https://core.telegram.org/bots/api#sendvideonote |
||
1117 | * |
||
1118 | * @param array $data |
||
1119 | * @param string $file |
||
1120 | * |
||
1121 | * @return \Longman\TelegramBot\Entities\ServerResponse |
||
1122 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
1123 | */ |
||
1124 | public static function sendVideoNote(array $data, $file = null) |
||
1130 | } |
||
1131 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..