Code Duplication    Length = 10-17 lines in 8 locations

src/BotApi.php 8 locations

@@ 679-688 (lines=10) @@
676
     * @throws \TelegramBot\Api\InvalidArgumentException
677
     * @throws \TelegramBot\Api\Exception
678
     */
679
    public function sendDocument(
680
        $chatId,
681
        $document,
682
        $replyToMessageId = null,
683
        $replyMarkup = null,
684
        $disableNotification = false
685
    ) {
686
        return Message::fromResponse($this->call('sendDocument', [
687
            'chat_id' => $chatId,
688
            'document' => $document,
689
            'reply_to_message_id' => $replyToMessageId,
690
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
691
            'disable_notification' => (bool) $disableNotification
@@ 439-449 (lines=11) @@
436
     * @return \TelegramBot\Api\Types\Message
437
     * @throws \TelegramBot\Api\Exception
438
     */
439
    public function sendLocation(
440
        $chatId,
441
        $latitude,
442
        $longitude,
443
        $replyToMessageId = null,
444
        $replyMarkup = null,
445
        $disableNotification = false
446
    ) {
447
        return Message::fromResponse($this->call('sendLocation', [
448
            'chat_id' => $chatId,
449
            'latitude' => $latitude,
450
            'longitude' => $longitude,
451
            'reply_to_message_id' => $replyToMessageId,
452
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
@@ 470-479 (lines=10) @@
467
     * @throws \TelegramBot\Api\InvalidArgumentException
468
     * @throws \TelegramBot\Api\Exception
469
     */
470
    public function sendSticker(
471
        $chatId,
472
        $sticker,
473
        $replyToMessageId = null,
474
        $replyMarkup = null,
475
        $disableNotification = false
476
    ) {
477
        return Message::fromResponse($this->call('sendSticker', [
478
            'chat_id' => $chatId,
479
            'sticker' => $sticker,
480
            'reply_to_message_id' => $replyToMessageId,
481
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
482
            'disable_notification' => (bool) $disableNotification
@@ 542-552 (lines=11) @@
539
     * @throws \TelegramBot\Api\InvalidArgumentException
540
     * @throws \TelegramBot\Api\Exception
541
     */
542
    public function sendVoice(
543
        $chatId,
544
        $voice,
545
        $duration = null,
546
        $replyToMessageId = null,
547
        $replyMarkup = null,
548
        $disableNotification = false
549
    ) {
550
        return Message::fromResponse($this->call('sendVoice', [
551
            'chat_id' => $chatId,
552
            'voice' => $voice,
553
            'duration' => $duration,
554
            'reply_to_message_id' => $replyToMessageId,
555
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
@@ 647-657 (lines=11) @@
644
     * @throws \TelegramBot\Api\InvalidArgumentException
645
     * @throws \TelegramBot\Api\Exception
646
     */
647
    public function sendPhoto(
648
        $chatId,
649
        $photo,
650
        $caption = null,
651
        $replyToMessageId = null,
652
        $replyMarkup = null,
653
        $disableNotification = false
654
    ) {
655
        return Message::fromResponse($this->call('sendPhoto', [
656
            'chat_id' => $chatId,
657
            'photo' => $photo,
658
            'caption' => $caption,
659
            'reply_to_message_id' => $replyToMessageId,
660
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
@@ 840-856 (lines=17) @@
837
     * @throws \TelegramBot\Api\InvalidArgumentException
838
     * @throws \TelegramBot\Api\Exception
839
     */
840
    public function editMessageText(
841
        $chatId,
842
        $messageId,
843
        $text,
844
        $parseMode = null,
845
        $disablePreview = false,
846
        $replyMarkup = null
847
    ) {
848
        return Message::fromResponse($this->call('editMessageText', [
849
            'chat_id' => $chatId,
850
            'message_id' => $messageId,
851
            'text' => $text,
852
            'parse_mode' => $parseMode,
853
            'disable_web_page_preview' => $disablePreview,
854
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
855
        ]));
856
    }
857
858
    /**
859
     * Use this method to edit text messages sent by the bot or via the bot
@@ 870-882 (lines=13) @@
867
     * @throws \TelegramBot\Api\InvalidArgumentException
868
     * @throws \TelegramBot\Api\Exception
869
     */
870
    public function editMessageCaption(
871
        $chatId,
872
        $messageId,
873
        $caption = null,
874
        $replyMarkup = null
875
    ) {
876
        return Message::fromResponse($this->call('editMessageText', [
877
            'chat_id' => $chatId,
878
            'message_id' => $messageId,
879
            'caption' => $caption,
880
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
881
        ]));
882
    }
883
884
    /**
885
     * Use this method to edit only the reply markup of messages sent by the bot or via the bot
@@ 895-905 (lines=11) @@
892
     * @throws \TelegramBot\Api\InvalidArgumentException
893
     * @throws \TelegramBot\Api\Exception
894
     */
895
    public function editMessageReplyMarkup(
896
        $chatId,
897
        $messageId,
898
        $replyMarkup = null
899
    ) {
900
        return Message::fromResponse($this->call('editMessageText', [
901
            'chat_id' => $chatId,
902
            'message_id' => $messageId,
903
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
904
        ]));
905
    }
906
907
    /**
908
     * Close curl