Code Duplication    Length = 15-17 lines in 5 locations

src/BotApi.php 5 locations

@@ 621-635 (lines=15) @@
618
     * @throws \TelegramBot\Api\InvalidArgumentException
619
     * @throws \TelegramBot\Api\Exception
620
     */
621
    public function sendSticker(
622
        $chatId,
623
        $sticker,
624
        $replyToMessageId = null,
625
        $replyMarkup = null,
626
        $disableNotification = false
627
    ) {
628
        return Message::fromResponse($this->call('sendSticker', [
629
            'chat_id' => $chatId,
630
            'sticker' => $sticker,
631
            'reply_to_message_id' => $replyToMessageId,
632
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
633
            'disable_notification' => (bool)$disableNotification,
634
        ]));
635
    }
636
637
    /**
638
     * Use this method to send video files,
@@ 693-709 (lines=17) @@
690
     * @throws \TelegramBot\Api\InvalidArgumentException
691
     * @throws \TelegramBot\Api\Exception
692
     */
693
    public function sendVoice(
694
        $chatId,
695
        $voice,
696
        $duration = null,
697
        $replyToMessageId = null,
698
        $replyMarkup = null,
699
        $disableNotification = false
700
    ) {
701
        return Message::fromResponse($this->call('sendVoice', [
702
            'chat_id' => $chatId,
703
            'voice' => $voice,
704
            'duration' => $duration,
705
            'reply_to_message_id' => $replyToMessageId,
706
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
707
            'disable_notification' => (bool)$disableNotification,
708
        ]));
709
    }
710
711
    /**
712
     * Use this method to forward messages of any kind. On success, the sent Message is returned.
@@ 798-814 (lines=17) @@
795
     * @throws \TelegramBot\Api\InvalidArgumentException
796
     * @throws \TelegramBot\Api\Exception
797
     */
798
    public function sendPhoto(
799
        $chatId,
800
        $photo,
801
        $caption = null,
802
        $replyToMessageId = null,
803
        $replyMarkup = null,
804
        $disableNotification = false
805
    ) {
806
        return Message::fromResponse($this->call('sendPhoto', [
807
            'chat_id' => $chatId,
808
            'photo' => $photo,
809
            'caption' => $caption,
810
            'reply_to_message_id' => $replyToMessageId,
811
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
812
            'disable_notification' => (bool)$disableNotification,
813
        ]));
814
    }
815
816
    /**
817
     * Use this method to send general files. On success, the sent Message is returned.
@@ 831-847 (lines=17) @@
828
     * @throws \TelegramBot\Api\InvalidArgumentException
829
     * @throws \TelegramBot\Api\Exception
830
     */
831
    public function sendDocument(
832
        $chatId,
833
        $document,
834
        $caption = null,
835
        $replyToMessageId = null,
836
        $replyMarkup = null,
837
        $disableNotification = false
838
    ) {
839
        return Message::fromResponse($this->call('sendDocument', [
840
            'chat_id' => $chatId,
841
            'document' => $document,
842
            'caption' => $caption,
843
            'reply_to_message_id' => $replyToMessageId,
844
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
845
            'disable_notification' => (bool)$disableNotification,
846
        ]));
847
    }
848
849
    /**
850
     * Use this method to get basic info about a file and prepare it for downloading.
@@ 1039-1053 (lines=15) @@
1036
     * @throws \TelegramBot\Api\InvalidArgumentException
1037
     * @throws \TelegramBot\Api\Exception
1038
     */
1039
    public function editMessageCaption(
1040
        $chatId,
1041
        $messageId,
1042
        $caption = null,
1043
        $replyMarkup = null,
1044
        $inlineMessageId = null
1045
    ) {
1046
        return Message::fromResponse($this->call('editMessageCaption', [
1047
            'chat_id' => $chatId,
1048
            'message_id' => $messageId,
1049
            'inline_message_id' => $inlineMessageId,
1050
            'caption' => $caption,
1051
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
1052
        ]));
1053
    }
1054
1055
    /**
1056
     * Use this method to edit only the reply markup of messages sent by the bot or via the bot