Code Duplication    Length = 9-11 lines in 4 locations

src/CoreBot.php 4 locations

@@ 663-672 (lines=10) @@
660
     * - <code>find_location</code> for location data
661
     * @return True on success.
662
     */
663
    public function sendChatAction(string $action) : bool {
664
665
        $parameters = [
666
            'chat_id' => $this->_chat_id,
667
            'action' => $action
668
        ];
669
670
        return $this->exec_curl_request($this->_api_url . 'sendChatAction?' . http_build_query($parameters));
671
672
    }
673
674
    /**
675
     * \brief Get info about a chat.
@@ 679-687 (lines=9) @@
676
     * \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)
677
     * @param Unique identifier for the target chat or username of the target supergroup or channel (in the format <code>@channelusername</code>)
678
     */
679
    public function getChat($_chat_id) {
680
681
        $parameters = [
682
            'chat_id' => $_chat_id,
683
        ];
684
685
        return $this->exec_curl_request($this->_api_url . 'getChat?' . http_build_query($parameters));
686
687
    }
688
689
    /**
690
     * \brief Use this method to get a list of administrators in a chat.
@@ 694-702 (lines=9) @@
691
     * @param Unique identifier for the target chat or username of the target supergroup or channel (in the format <code>@channelusername</code>)
692
     * @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.
693
     */
694
    public function getChatAdministrators($_chat_id) {
695
696
        $parameters = [
697
            'chat_id' => $_chat_id,
698
        ];
699
700
        return $this->exec_curl_request($this->_api_url . 'getChatAdministrators?' . http_build_query($parameters));
701
702
    }
703
704
705
    /* \brief Answer a callback query
@@ 786-796 (lines=11) @@
783
     * $message_id Identifier of the message to edit
784
     * $inline_keyboard Inlike keyboard array (https://core.telegram.org/bots/api#inlinekeyboardmarkup)
785
     */
786
    public function editMessageReplyMarkup($message_id, $inline_keyboard) {
787
788
        $parameters = [
789
            'chat_id' => $this->_chat_id,
790
            'message_id' => $message_id,
791
            'reply_markup' => $inline_keyboard,
792
        ];
793
794
        return $this->exec_curl_request($this->_api_url . 'editMessageReplyMarkup?' . http_build_query($parameters));
795
796
    }
797
798
    /*
799
     * 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)