Code Duplication    Length = 13-19 lines in 8 locations

src/BotApi.php 8 locations

@@ 338-356 (lines=19) @@
335
     * @return \TelegramBot\Api\Types\Message
336
     * @throws \TelegramBot\Api\Exception
337
     */
338
    public function sendContact(
339
        $chatId,
340
        $phoneNumber,
341
        $firstName,
342
        $lastName = null,
343
        $replyToMessageId = null,
344
        $replyMarkup = null,
345
        $disableNotification = false
346
    ) {
347
        return Message::fromResponse($this->call('sendContact', [
348
            'chat_id' => $chatId,
349
            'phone_number' => $phoneNumber,
350
            'first_name' => $firstName,
351
            'last_name' => $lastName,
352
            'reply_to_message_id' => $replyToMessageId,
353
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
354
            'disable_notification' => (bool)$disableNotification,
355
        ]));
356
    }
357
358
    /**
359
     * Use this method when you need to tell the user that something is happening on the bot's side.
@@ 481-497 (lines=17) @@
478
     * @return \TelegramBot\Api\Types\Message
479
     * @throws \TelegramBot\Api\Exception
480
     */
481
    public function sendLocation(
482
        $chatId,
483
        $latitude,
484
        $longitude,
485
        $replyToMessageId = null,
486
        $replyMarkup = null,
487
        $disableNotification = false
488
    ) {
489
        return Message::fromResponse($this->call('sendLocation', [
490
            'chat_id' => $chatId,
491
            'latitude' => $latitude,
492
            'longitude' => $longitude,
493
            'reply_to_message_id' => $replyToMessageId,
494
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
495
            'disable_notification' => (bool)$disableNotification,
496
        ]));
497
    }
498
499
    /**
500
     * Use this method to send information about a venue. On success, the sent Message is returned.
@@ 552-566 (lines=15) @@
549
     * @throws \TelegramBot\Api\InvalidArgumentException
550
     * @throws \TelegramBot\Api\Exception
551
     */
552
    public function sendSticker(
553
        $chatId,
554
        $sticker,
555
        $replyToMessageId = null,
556
        $replyMarkup = null,
557
        $disableNotification = false
558
    ) {
559
        return Message::fromResponse($this->call('sendSticker', [
560
            'chat_id' => $chatId,
561
            'sticker' => $sticker,
562
            'reply_to_message_id' => $replyToMessageId,
563
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
564
            'disable_notification' => (bool)$disableNotification,
565
        ]));
566
    }
567
568
    /**
569
     * Use this method to send video files,
@@ 624-640 (lines=17) @@
621
     * @throws \TelegramBot\Api\InvalidArgumentException
622
     * @throws \TelegramBot\Api\Exception
623
     */
624
    public function sendVoice(
625
        $chatId,
626
        $voice,
627
        $duration = null,
628
        $replyToMessageId = null,
629
        $replyMarkup = null,
630
        $disableNotification = false
631
    ) {
632
        return Message::fromResponse($this->call('sendVoice', [
633
            'chat_id' => $chatId,
634
            'voice' => $voice,
635
            'duration' => $duration,
636
            'reply_to_message_id' => $replyToMessageId,
637
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
638
            'disable_notification' => (bool)$disableNotification,
639
        ]));
640
    }
641
642
    /**
643
     * Use this method to forward messages of any kind. On success, the sent Message is returned.
@@ 729-745 (lines=17) @@
726
     * @throws \TelegramBot\Api\InvalidArgumentException
727
     * @throws \TelegramBot\Api\Exception
728
     */
729
    public function sendPhoto(
730
        $chatId,
731
        $photo,
732
        $caption = null,
733
        $replyToMessageId = null,
734
        $replyMarkup = null,
735
        $disableNotification = false
736
    ) {
737
        return Message::fromResponse($this->call('sendPhoto', [
738
            'chat_id' => $chatId,
739
            'photo' => $photo,
740
            'caption' => $caption,
741
            'reply_to_message_id' => $replyToMessageId,
742
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
743
            'disable_notification' => (bool)$disableNotification,
744
        ]));
745
    }
746
747
    /**
748
     * Use this method to send general files. On success, the sent Message is returned.
@@ 762-778 (lines=17) @@
759
     * @throws \TelegramBot\Api\InvalidArgumentException
760
     * @throws \TelegramBot\Api\Exception
761
     */
762
    public function sendDocument(
763
        $chatId,
764
        $document,
765
        $caption = null,
766
        $replyToMessageId = null,
767
        $replyMarkup = null,
768
        $disableNotification = false
769
    ) {
770
        return Message::fromResponse($this->call('sendDocument', [
771
            'chat_id' => $chatId,
772
            'document' => $document,
773
            'caption' => $caption,
774
            'reply_to_message_id' => $replyToMessageId,
775
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
776
            'disable_notification' => (bool)$disableNotification,
777
        ]));
778
    }
779
780
    /**
781
     * Use this method to get basic info about a file and prepare it for downloading.
@@ 927-945 (lines=19) @@
924
     * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply|null $replyMarkup
925
     * @return Message
926
     */
927
    public function editMessageText(
928
        $chatId,
929
        $messageId,
930
        $text,
931
        $parseMode = null,
932
        $disablePreview = false,
933
        $replyMarkup = null,
934
        $inlineMessageId = null
935
    ) {
936
        return Message::fromResponse($this->call('editMessageText', [
937
            'chat_id' => $chatId,
938
            'message_id' => $messageId,
939
            'text' => $text,
940
            'inline_message_id' => $inlineMessageId,
941
            'parse_mode' => $parseMode,
942
            'disable_web_page_preview' => $disablePreview,
943
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
944
        ]));
945
    }
946
947
    /**
948
     * Use this method to edit text messages sent by the bot or via the bot
@@ 986-998 (lines=13) @@
983
     *
984
     * @return Message
985
     */
986
    public function editMessageReplyMarkup(
987
        $chatId,
988
        $messageId,
989
        $replyMarkup = null,
990
        $inlineMessageId = null
991
    ) {
992
        return Message::fromResponse($this->call('editMessageReplyMarkup', [
993
            'chat_id' => $chatId,
994
            'message_id' => $messageId,
995
            'inline_message_id' => $inlineMessageId,
996
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
997
        ]));
998
    }
999
1000
    /**
1001
     * Use this method to delete a message, including service messages, with the following limitations: