Code Duplication    Length = 19-20 lines in 2 locations

src/Core/CoreBot.php 2 locations

@@ 802-821 (lines=20) @@
799
     * $results Array on InlineQueryResult (https://core.telegram.org/bots/api#inlinequeryresult)
800
     * $switch_pm_text Text to show on the button
801
     */
802
    public function answerInlineQuerySwitchPM($results, $switch_pm_text, $switch_pm_parameter = '', $is_personal = true, $cache_time = 300) {
803
804
        if (!isset($this->_inline_query_id)) {
805
806
            throw new BotException("Inline query id not set, wrong update");
807
808
        }
809
810
        $parameters = [
811
            'inline_query_id' => $this->_inline_query_id,
812
            'switch_pm_text' => $switch_pm_text,
813
            'is_personal' => $is_personal,
814
            'switch_pm_parameter' => $switch_pm_parameter,
815
            'results' => $results,
816
            'cache_time' => $cache_time
817
        ];
818
819
        return $this->exec_curl_request('answerInlineQuery?' . http_build_query($parameters));
820
821
    }
822
823
    /*
824
     * 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)
@@ 829-847 (lines=19) @@
826
     * @param
827
     * $switch_pm_text Text to show on the button
828
     */
829
    public function answerEmptyInlineQuerySwitchPM($switch_pm_text, $switch_pm_parameter = '', $is_personal = true, $cache_time = 300) {
830
831
        if (!isset($this->_inline_query_id)) {
832
833
            throw new BotException("Inline query id not set, wrong update");
834
835
        }
836
837
        $parameters = [
838
            'inline_query_id' => $this->_inline_query_id,
839
            'switch_pm_text' => $switch_pm_text,
840
            'is_personal' => $is_personal,
841
            'switch_pm_parameter' => $switch_pm_parameter,
842
            'cache_time' => $cache_time
843
        ];
844
845
        return $this->exec_curl_request('answerInlineQuery?' . http_build_query($parameters));
846
847
    }
848
849
    /**
850
     * \brief Exec any api request using this method.