Code Duplication    Length = 13-19 lines in 8 locations

src/BotApi.php 8 locations

@@ 342-360 (lines=19) @@
339
     * @return \TelegramBot\Api\Types\Message
340
     * @throws \TelegramBot\Api\Exception
341
     */
342
    public function sendContact(
343
        $chatId,
344
        $phoneNumber,
345
        $firstName,
346
        $lastName = null,
347
        $replyToMessageId = null,
348
        $replyMarkup = null,
349
        $disableNotification = false
350
    ) {
351
        return Message::fromResponse($this->call('sendContact', [
352
            'chat_id' => $chatId,
353
            'phone_number' => $phoneNumber,
354
            'first_name' => $firstName,
355
            'last_name' => $lastName,
356
            'reply_to_message_id' => $replyToMessageId,
357
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
358
            'disable_notification' => (bool)$disableNotification,
359
        ]));
360
    }
361
362
    /**
363
     * Use this method when you need to tell the user that something is happening on the bot's side.
@@ 485-501 (lines=17) @@
482
     * @return \TelegramBot\Api\Types\Message
483
     * @throws \TelegramBot\Api\Exception
484
     */
485
    public function sendLocation(
486
        $chatId,
487
        $latitude,
488
        $longitude,
489
        $replyToMessageId = null,
490
        $replyMarkup = null,
491
        $disableNotification = false
492
    ) {
493
        return Message::fromResponse($this->call('sendLocation', [
494
            'chat_id' => $chatId,
495
            'latitude' => $latitude,
496
            'longitude' => $longitude,
497
            'reply_to_message_id' => $replyToMessageId,
498
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
499
            'disable_notification' => (bool)$disableNotification,
500
        ]));
501
    }
502
503
    /**
504
     * Use this method to send information about a venue. On success, the sent Message is returned.
@@ 556-570 (lines=15) @@
553
     * @throws \TelegramBot\Api\InvalidArgumentException
554
     * @throws \TelegramBot\Api\Exception
555
     */
556
    public function sendSticker(
557
        $chatId,
558
        $sticker,
559
        $replyToMessageId = null,
560
        $replyMarkup = null,
561
        $disableNotification = false
562
    ) {
563
        return Message::fromResponse($this->call('sendSticker', [
564
            'chat_id' => $chatId,
565
            'sticker' => $sticker,
566
            'reply_to_message_id' => $replyToMessageId,
567
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
568
            'disable_notification' => (bool)$disableNotification,
569
        ]));
570
    }
571
572
    /**
573
     * Use this method to send video files,
@@ 628-644 (lines=17) @@
625
     * @throws \TelegramBot\Api\InvalidArgumentException
626
     * @throws \TelegramBot\Api\Exception
627
     */
628
    public function sendVoice(
629
        $chatId,
630
        $voice,
631
        $duration = null,
632
        $replyToMessageId = null,
633
        $replyMarkup = null,
634
        $disableNotification = false
635
    ) {
636
        return Message::fromResponse($this->call('sendVoice', [
637
            'chat_id' => $chatId,
638
            'voice' => $voice,
639
            'duration' => $duration,
640
            'reply_to_message_id' => $replyToMessageId,
641
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
642
            'disable_notification' => (bool)$disableNotification,
643
        ]));
644
    }
645
646
    /**
647
     * Use this method to forward messages of any kind. On success, the sent Message is returned.
@@ 733-749 (lines=17) @@
730
     * @throws \TelegramBot\Api\InvalidArgumentException
731
     * @throws \TelegramBot\Api\Exception
732
     */
733
    public function sendPhoto(
734
        $chatId,
735
        $photo,
736
        $caption = null,
737
        $replyToMessageId = null,
738
        $replyMarkup = null,
739
        $disableNotification = false
740
    ) {
741
        return Message::fromResponse($this->call('sendPhoto', [
742
            'chat_id' => $chatId,
743
            'photo' => $photo,
744
            'caption' => $caption,
745
            'reply_to_message_id' => $replyToMessageId,
746
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
747
            'disable_notification' => (bool)$disableNotification,
748
        ]));
749
    }
750
751
    /**
752
     * Use this method to send general files. On success, the sent Message is returned.
@@ 766-782 (lines=17) @@
763
     * @throws \TelegramBot\Api\InvalidArgumentException
764
     * @throws \TelegramBot\Api\Exception
765
     */
766
    public function sendDocument(
767
        $chatId,
768
        $document,
769
        $caption = null,
770
        $replyToMessageId = null,
771
        $replyMarkup = null,
772
        $disableNotification = false
773
    ) {
774
        return Message::fromResponse($this->call('sendDocument', [
775
            'chat_id' => $chatId,
776
            'document' => $document,
777
            'caption' => $caption,
778
            'reply_to_message_id' => $replyToMessageId,
779
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
780
            'disable_notification' => (bool)$disableNotification,
781
        ]));
782
    }
783
784
    /**
785
     * Use this method to get basic info about a file and prepare it for downloading.
@@ 941-959 (lines=19) @@
938
     * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply|null $replyMarkup
939
     * @return Message
940
     */
941
    public function editMessageText(
942
        $chatId,
943
        $messageId,
944
        $text,
945
        $parseMode = null,
946
        $disablePreview = false,
947
        $replyMarkup = null,
948
        $inlineMessageId = null
949
    ) {
950
        return Message::fromResponse($this->call('editMessageText', [
951
            'chat_id' => $chatId,
952
            'message_id' => $messageId,
953
            'text' => $text,
954
            'inline_message_id' => $inlineMessageId,
955
            'parse_mode' => $parseMode,
956
            'disable_web_page_preview' => $disablePreview,
957
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
958
        ]));
959
    }
960
961
    /**
962
     * Use this method to edit text messages sent by the bot or via the bot
@@ 1000-1012 (lines=13) @@
997
     *
998
     * @return Message
999
     */
1000
    public function editMessageReplyMarkup(
1001
        $chatId,
1002
        $messageId,
1003
        $replyMarkup = null,
1004
        $inlineMessageId = null
1005
    ) {
1006
        return Message::fromResponse($this->call('editMessageReplyMarkup', [
1007
            'chat_id' => $chatId,
1008
            'message_id' => $messageId,
1009
            'inline_message_id' => $inlineMessageId,
1010
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
1011
        ]));
1012
    }
1013
1014
    /**
1015
     * Use this method to delete a message, including service messages, with the following limitations: