Code Duplication    Length = 9-11 lines in 4 locations

src/CoreBot.php 4 locations

@@ 635-644 (lines=10) @@
632
     * - <code>find_location</code> for location data
633
     * @return True on success.
634
     */
635
    public function sendChatAction(string $action) : bool {
636
637
        $parameters = [
638
            'chat_id' => $this->_chat_id,
639
            'action' => $action
640
        ];
641
642
        return $this->exec_curl_request($this->_api_url . 'sendChatAction?' . http_build_query($parameters));
643
644
    }
645
646
    /**
647
     * \brief Get info about a chat.
@@ 651-659 (lines=9) @@
648
     * \details 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.). [Api reference](https://core.telegram.org/bots/api#getchat)
649
     * @param Unique identifier for the target chat or username of the target supergroup or channel (in the format <code>@channelusername</code>)
650
     */
651
    public function getChat($_chat_id) {
652
653
        $parameters = [
654
            'chat_id' => $_chat_id,
655
        ];
656
657
        return $this->exec_curl_request($this->_api_url . 'getChat?' . http_build_query($parameters));
658
659
    }
660
661
    /**
662
     * \brief Use this method to get a list of administrators in a chat.
@@ 666-674 (lines=9) @@
663
     * @param Unique identifier for the target chat or username of the target supergroup or channel (in the format <code>@channelusername</code>)
664
     * @return On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
665
     */
666
    public function getChatAdministrators($_chat_id) {
667
668
        $parameters = [
669
            'chat_id' => $_chat_id,
670
        ];
671
672
        return $this->exec_curl_request($this->_api_url . 'getChatAdministrators?' . http_build_query($parameters));
673
674
    }
675
676
677
    /* \brief Answer a callback query
@@ 758-768 (lines=11) @@
755
     * $message_id Identifier of the message to edit
756
     * $inline_keyboard Inlike keyboard array (https://core.telegram.org/bots/api#inlinekeyboardmarkup)
757
     */
758
    public function editMessageReplyMarkup($message_id, $inline_keyboard) {
759
760
        $parameters = [
761
            'chat_id' => $this->_chat_id,
762
            'message_id' => $message_id,
763
            'reply_markup' => $inline_keyboard,
764
        ];
765
766
        return $this->exec_curl_request($this->_api_url . 'editMessageReplyMarkup?' . http_build_query($parameters));
767
768
    }
769
770
    /*
771
     * Answer a inline query (when the user write @botusername "Query") with a button, that will make user switch to the private chat with the bot, on the top of the results (https://core.telegram.org/bots/api#answerinlinequery)