Code Duplication    Length = 15-19 lines in 7 locations

src/BotApi.php 7 locations

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