Code Duplication    Length = 15-19 lines in 7 locations

src/BotApi.php 7 locations

@@ 334-352 (lines=19) @@
331
     * @return \TelegramBot\Api\Types\Message
332
     * @throws \TelegramBot\Api\Exception
333
     */
334
    public function sendContact(
335
        $chatId,
336
        $phoneNumber,
337
        $firstName,
338
        $lastName = null,
339
        $replyToMessageId = null,
340
        $replyMarkup = null,
341
        $disableNotification = false
342
    ) {
343
        return Message::fromResponse($this->call('sendContact', [
344
            'chat_id' => $chatId,
345
            'phone_number' => $phoneNumber,
346
            'first_name' => $firstName,
347
            'last_name' => $lastName,
348
            'reply_to_message_id' => $replyToMessageId,
349
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
350
            'disable_notification' => (bool)$disableNotification,
351
        ]));
352
    }
353
354
    /**
355
     * Use this method when you need to tell the user that something is happening on the bot's side.
@@ 477-493 (lines=17) @@
474
     * @return \TelegramBot\Api\Types\Message
475
     * @throws \TelegramBot\Api\Exception
476
     */
477
    public function sendLocation(
478
        $chatId,
479
        $latitude,
480
        $longitude,
481
        $replyToMessageId = null,
482
        $replyMarkup = null,
483
        $disableNotification = false
484
    ) {
485
        return Message::fromResponse($this->call('sendLocation', [
486
            'chat_id' => $chatId,
487
            'latitude' => $latitude,
488
            'longitude' => $longitude,
489
            'reply_to_message_id' => $replyToMessageId,
490
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
491
            'disable_notification' => (bool)$disableNotification,
492
        ]));
493
    }
494
495
    /**
496
     * Use this method to send information about a venue. On success, the sent Message is returned.
@@ 548-562 (lines=15) @@
545
     * @throws \TelegramBot\Api\InvalidArgumentException
546
     * @throws \TelegramBot\Api\Exception
547
     */
548
    public function sendSticker(
549
        $chatId,
550
        $sticker,
551
        $replyToMessageId = null,
552
        $replyMarkup = null,
553
        $disableNotification = false
554
    ) {
555
        return Message::fromResponse($this->call('sendSticker', [
556
            'chat_id' => $chatId,
557
            'sticker' => $sticker,
558
            'reply_to_message_id' => $replyToMessageId,
559
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
560
            'disable_notification' => (bool)$disableNotification,
561
        ]));
562
    }
563
564
    /**
565
     * Use this method to send video files,
@@ 620-636 (lines=17) @@
617
     * @throws \TelegramBot\Api\InvalidArgumentException
618
     * @throws \TelegramBot\Api\Exception
619
     */
620
    public function sendVoice(
621
        $chatId,
622
        $voice,
623
        $duration = null,
624
        $replyToMessageId = null,
625
        $replyMarkup = null,
626
        $disableNotification = false
627
    ) {
628
        return Message::fromResponse($this->call('sendVoice', [
629
            'chat_id' => $chatId,
630
            'voice' => $voice,
631
            'duration' => $duration,
632
            'reply_to_message_id' => $replyToMessageId,
633
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
634
            'disable_notification' => (bool)$disableNotification,
635
        ]));
636
    }
637
638
    /**
639
     * Use this method to forward messages of any kind. On success, the sent Message is returned.
@@ 725-741 (lines=17) @@
722
     * @throws \TelegramBot\Api\InvalidArgumentException
723
     * @throws \TelegramBot\Api\Exception
724
     */
725
    public function sendPhoto(
726
        $chatId,
727
        $photo,
728
        $caption = null,
729
        $replyToMessageId = null,
730
        $replyMarkup = null,
731
        $disableNotification = false
732
    ) {
733
        return Message::fromResponse($this->call('sendPhoto', [
734
            'chat_id' => $chatId,
735
            'photo' => $photo,
736
            'caption' => $caption,
737
            'reply_to_message_id' => $replyToMessageId,
738
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
739
            'disable_notification' => (bool)$disableNotification,
740
        ]));
741
    }
742
743
    /**
744
     * Use this method to send general files. On success, the sent Message is returned.
@@ 758-774 (lines=17) @@
755
     * @throws \TelegramBot\Api\InvalidArgumentException
756
     * @throws \TelegramBot\Api\Exception
757
     */
758
    public function sendDocument(
759
        $chatId,
760
        $document,
761
        $caption = null,
762
        $replyToMessageId = null,
763
        $replyMarkup = null,
764
        $disableNotification = false
765
    ) {
766
        return Message::fromResponse($this->call('sendDocument', [
767
            'chat_id' => $chatId,
768
            'document' => $document,
769
            'caption' => $caption,
770
            'reply_to_message_id' => $replyToMessageId,
771
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
772
            'disable_notification' => (bool)$disableNotification,
773
        ]));
774
    }
775
776
    /**
777
     * Use this method to get basic info about a file and prepare it for downloading.
@@ 921-937 (lines=17) @@
918
     * @throws \TelegramBot\Api\InvalidArgumentException
919
     * @throws \TelegramBot\Api\Exception
920
     */
921
    public function editMessageText(
922
        $chatId,
923
        $messageId,
924
        $text,
925
        $parseMode = null,
926
        $disablePreview = false,
927
        $replyMarkup = null
928
    ) {
929
        return Message::fromResponse($this->call('editMessageText', [
930
            'chat_id' => $chatId,
931
            'message_id' => $messageId,
932
            'text' => $text,
933
            'parse_mode' => $parseMode,
934
            'disable_web_page_preview' => $disablePreview,
935
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
936
        ]));
937
    }
938
939
    /**
940
     * Use this method to edit text messages sent by the bot or via the bot