Code Duplication    Length = 15-17 lines in 5 locations

src/BotApi.php 5 locations

@@ 608-622 (lines=15) @@
605
     * @throws \TelegramBot\Api\InvalidArgumentException
606
     * @throws \TelegramBot\Api\Exception
607
     */
608
    public function sendSticker(
609
        $chatId,
610
        $sticker,
611
        $replyToMessageId = null,
612
        $replyMarkup = null,
613
        $disableNotification = false
614
    ) {
615
        return Message::fromResponse($this->call('sendSticker', [
616
            'chat_id' => $chatId,
617
            'sticker' => $sticker,
618
            'reply_to_message_id' => $replyToMessageId,
619
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
620
            'disable_notification' => (bool)$disableNotification,
621
        ]));
622
    }
623
624
    /**
625
     * Use this method to send video files,
@@ 680-696 (lines=17) @@
677
     * @throws \TelegramBot\Api\InvalidArgumentException
678
     * @throws \TelegramBot\Api\Exception
679
     */
680
    public function sendVoice(
681
        $chatId,
682
        $voice,
683
        $duration = null,
684
        $replyToMessageId = null,
685
        $replyMarkup = null,
686
        $disableNotification = false
687
    ) {
688
        return Message::fromResponse($this->call('sendVoice', [
689
            'chat_id' => $chatId,
690
            'voice' => $voice,
691
            'duration' => $duration,
692
            'reply_to_message_id' => $replyToMessageId,
693
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
694
            'disable_notification' => (bool)$disableNotification,
695
        ]));
696
    }
697
698
    /**
699
     * Use this method to forward messages of any kind. On success, the sent Message is returned.
@@ 785-801 (lines=17) @@
782
     * @throws \TelegramBot\Api\InvalidArgumentException
783
     * @throws \TelegramBot\Api\Exception
784
     */
785
    public function sendPhoto(
786
        $chatId,
787
        $photo,
788
        $caption = null,
789
        $replyToMessageId = null,
790
        $replyMarkup = null,
791
        $disableNotification = false
792
    ) {
793
        return Message::fromResponse($this->call('sendPhoto', [
794
            'chat_id' => $chatId,
795
            'photo' => $photo,
796
            'caption' => $caption,
797
            'reply_to_message_id' => $replyToMessageId,
798
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
799
            'disable_notification' => (bool)$disableNotification,
800
        ]));
801
    }
802
803
    /**
804
     * Use this method to send general files. On success, the sent Message is returned.
@@ 818-834 (lines=17) @@
815
     * @throws \TelegramBot\Api\InvalidArgumentException
816
     * @throws \TelegramBot\Api\Exception
817
     */
818
    public function sendDocument(
819
        $chatId,
820
        $document,
821
        $caption = null,
822
        $replyToMessageId = null,
823
        $replyMarkup = null,
824
        $disableNotification = false
825
    ) {
826
        return Message::fromResponse($this->call('sendDocument', [
827
            'chat_id' => $chatId,
828
            'document' => $document,
829
            'caption' => $caption,
830
            'reply_to_message_id' => $replyToMessageId,
831
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
832
            'disable_notification' => (bool)$disableNotification,
833
        ]));
834
    }
835
836
    /**
837
     * Use this method to get basic info about a file and prepare it for downloading.
@@ 1026-1040 (lines=15) @@
1023
     * @throws \TelegramBot\Api\InvalidArgumentException
1024
     * @throws \TelegramBot\Api\Exception
1025
     */
1026
    public function editMessageCaption(
1027
        $chatId,
1028
        $messageId,
1029
        $caption = null,
1030
        $replyMarkup = null,
1031
        $inlineMessageId = null
1032
    ) {
1033
        return Message::fromResponse($this->call('editMessageCaption', [
1034
            'chat_id' => $chatId,
1035
            'message_id' => $messageId,
1036
            'inline_message_id' => $inlineMessageId,
1037
            'caption' => $caption,
1038
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
1039
        ]));
1040
    }
1041
1042
    /**
1043
     * Use this method to edit only the reply markup of messages sent by the bot or via the bot