Code Duplication    Length = 23-25 lines in 4 locations

src/BotApi.php 4 locations

@@ 364-388 (lines=25) @@
361
     * @throws HttpException
362
     * @throws InvalidJsonException
363
     */
364
    public function copyMessage(
365
        $chatId,
366
        $fromChatId,
367
        $messageId,
368
        $caption = null,
369
        $parseMode = null,
370
        $captionEntities = null,
371
        $disableNotification = false,
372
        $replyToMessageId = null,
373
        $allowSendingWithoutReply = false,
374
        $replyMarkup = null
375
    ) {
376
        return Message::fromResponse($this->call('copyMessage', [
377
            'chat_id' => $chatId,
378
            'from_chat_id' => $fromChatId,
379
            'message_id' => (int)$messageId,
380
            'caption' => $caption,
381
            'parse_mode' => $parseMode,
382
            'caption_entities' => $captionEntities,
383
            'disable_notification' => (bool)$disableNotification,
384
            'reply_to_message_id' => (int)$replyToMessageId,
385
            'allow_sending_without_reply' => (bool)$allowSendingWithoutReply,
386
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
387
        ]));
388
    }
389
390
    /**
391
     * Use this method to send phone contacts
@@ 742-764 (lines=23) @@
739
     * @throws \TelegramBot\Api\InvalidArgumentException
740
     * @throws \TelegramBot\Api\Exception
741
     */
742
    public function sendVideo(
743
        $chatId,
744
        $video,
745
        $duration = null,
746
        $caption = null,
747
        $replyToMessageId = null,
748
        $replyMarkup = null,
749
        $disableNotification = false,
750
        $supportsStreaming = false,
751
        $parseMode = null
752
    ) {
753
        return Message::fromResponse($this->call('sendVideo', [
754
            'chat_id' => $chatId,
755
            'video' => $video,
756
            'duration' => $duration,
757
            'caption' => $caption,
758
            'reply_to_message_id' => $replyToMessageId,
759
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
760
            'disable_notification' => (bool)$disableNotification,
761
            'supports_streaming' => (bool)$supportsStreaming,
762
            'parse_mode' => $parseMode
763
        ]));
764
    }
765
766
    /**
767
     * Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound),
@@ 831-853 (lines=23) @@
828
     * @throws \TelegramBot\Api\InvalidArgumentException
829
     * @throws \TelegramBot\Api\Exception
830
     */
831
    public function sendVoice(
832
        $chatId,
833
        $voice,
834
        $caption = null,
835
        $duration = null,
836
        $replyToMessageId = null,
837
        $replyMarkup = null,
838
        $disableNotification = false,
839
        $allowSendingWithoutReply = false,
840
        $parseMode = null
841
    ) {
842
        return Message::fromResponse($this->call('sendVoice', [
843
            'chat_id' => $chatId,
844
            'voice' => $voice,
845
            'caption' => $caption,
846
            'duration' => $duration,
847
            'reply_to_message_id' => $replyToMessageId,
848
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
849
            'disable_notification' => (bool)$disableNotification,
850
            'allow_sending_without_reply' => $allowSendingWithoutReply,
851
            'parse_mode' => $parseMode
852
        ]));
853
    }
854
855
    /**
856
     * Use this method to forward messages of any kind. On success, the sent Message is returned.
@@ 908-930 (lines=23) @@
905
     * @throws \TelegramBot\Api\InvalidArgumentException
906
     * @throws \TelegramBot\Api\Exception
907
     */
908
    public function sendAudio(
909
        $chatId,
910
        $audio,
911
        $duration = null,
912
        $performer = null,
913
        $title = null,
914
        $replyToMessageId = null,
915
        $replyMarkup = null,
916
        $disableNotification = false,
917
        $parseMode = null
918
    ) {
919
        return Message::fromResponse($this->call('sendAudio', [
920
            'chat_id' => $chatId,
921
            'audio' => $audio,
922
            'duration' => $duration,
923
            'performer' => $performer,
924
            'title' => $title,
925
            'reply_to_message_id' => $replyToMessageId,
926
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
927
            'disable_notification' => (bool)$disableNotification,
928
            'parse_mode' => $parseMode
929
        ]));
930
    }
931
932
    /**
933
     * Use this method to send photos. On success, the sent Message is returned.