Code Duplication    Length = 12-14 lines in 2 locations

src/CoreBot.php 2 locations

@@ 717-730 (lines=14) @@
714
     * $results Array on InlineQueryResult (https://core.telegram.org/bots/api#inlinequeryresult)
715
     * $switch_pm_text Text to show on the button
716
     */
717
    public function answerInlineQuerySwitchPM($results, $switch_pm_text, $switch_pm_parameter = '', $is_personal = true, $cache_time = 300) {
718
719
        $parameters = [
720
            'inline_query_id' => $this->update['inline_query']['id'],
721
            'switch_pm_text' => $switch_pm_text,
722
            'is_personal' => $is_personal,
723
            'switch_pm_parameter' => $switch_pm_parameter,
724
            'results' => $results,
725
            'cache_time' => $cache_time
726
        ];
727
728
        return $this->exec_curl_request($this->api_url . 'answerInlineQuery?' . http_build_query($parameters));
729
730
    }
731
732
    /*
733
     * 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)
@@ 738-749 (lines=12) @@
735
     * @param
736
     * $switch_pm_text Text to show on the button
737
     */
738
    public function answerEmptyInlineQuerySwitchPM($switch_pm_text, $switch_pm_parameter = '', $is_personal = true, $cache_time = 300) {
739
        $parameters = [
740
            'inline_query_id' => $this->update['inline_query']['id'],
741
            'switch_pm_text' => $switch_pm_text,
742
            'is_personal' => $is_personal,
743
            'switch_pm_parameter' => $switch_pm_parameter,
744
            'cache_time' => $cache_time
745
        ];
746
747
        return $this->exec_curl_request($this->api_url . 'answerInlineQuery?' . http_build_query($parameters));
748
749
    }
750
751
    /**
752
     * \brief Exec any api request using this method.