Code Duplication    Length = 12-14 lines in 2 locations

src/CoreBot.php 2 locations

@@ 773-786 (lines=14) @@
770
     * $results Array on InlineQueryResult (https://core.telegram.org/bots/api#inlinequeryresult)
771
     * $switch_pm_text Text to show on the button
772
     */
773
    public function answerInlineQuerySwitchPM($results, $switch_pm_text, $switch_pm_parameter = '', $is_personal = true, $cache_time = 300) {
774
775
        $parameters = [
776
            'inline_query_id' => $this->update['inline_query']['id'],
777
            'switch_pm_text' => $switch_pm_text,
778
            'is_personal' => $is_personal,
779
            'switch_pm_parameter' => $switch_pm_parameter,
780
            'results' => $results,
781
            'cache_time' => $cache_time
782
        ];
783
784
        return $this->exec_curl_request($this->api_url . 'answerInlineQuery?' . http_build_query($parameters));
785
786
    }
787
788
    /*
789
     * 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)
@@ 794-805 (lines=12) @@
791
     * @param
792
     * $switch_pm_text Text to show on the button
793
     */
794
    public function answerEmptyInlineQuerySwitchPM($switch_pm_text, $switch_pm_parameter = '', $is_personal = true, $cache_time = 300) {
795
        $parameters = [
796
            'inline_query_id' => $this->update['inline_query']['id'],
797
            'switch_pm_text' => $switch_pm_text,
798
            'is_personal' => $is_personal,
799
            'switch_pm_parameter' => $switch_pm_parameter,
800
            'cache_time' => $cache_time
801
        ];
802
803
        return $this->exec_curl_request($this->api_url . 'answerInlineQuery?' . http_build_query($parameters));
804
805
    }
806
807
    /**
808
     * \brief Exec any api request using this method.