Code Duplication    Length = 13-19 lines in 8 locations

src/BotApi.php 8 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.
@@ 760-776 (lines=17) @@
757
     * @throws \TelegramBot\Api\InvalidArgumentException
758
     * @throws \TelegramBot\Api\Exception
759
     */
760
    public function sendDocument(
761
        $chatId,
762
        $document,
763
        $caption = null,
764
        $replyToMessageId = null,
765
        $replyMarkup = null,
766
        $disableNotification = false
767
    ) {
768
        return Message::fromResponse($this->call('sendDocument', [
769
            'chat_id' => $chatId,
770
            'document' => $document,
771
            'caption' => $caption,
772
            'reply_to_message_id' => $replyToMessageId,
773
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
774
            'disable_notification' => (bool)$disableNotification,
775
        ]));
776
    }
777
778
    /**
779
     * Use this method to get basic info about a file and prepare it for downloading.
@@ 921-939 (lines=19) @@
918
     * @param Types\ReplyKeyboardMarkup|Types\ReplyKeyboardHide|Types\ForceReply|null $replyMarkup
919
     * @return Message
920
     */
921
    public function editMessageText(
922
        $chatId,
923
        $messageId,
924
        $text,
925
        $parseMode = null,
926
        $disablePreview = false,
927
        $replyMarkup = null,
928
        $inlineMessageId = null
929
    ) {
930
        return Message::fromResponse($this->call('editMessageText', [
931
            'chat_id' => $chatId,
932
            'message_id' => $messageId,
933
            'text' => $text,
934
            'inline_message_id' => $inlineMessageId,
935
            'parse_mode' => $parseMode,
936
            'disable_web_page_preview' => $disablePreview,
937
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
938
        ]));
939
    }
940
941
    /**
942
     * Use this method to edit text messages sent by the bot or via the bot
@@ 980-992 (lines=13) @@
977
     *
978
     * @return Message
979
     */
980
    public function editMessageReplyMarkup(
981
        $chatId,
982
        $messageId,
983
        $replyMarkup = null,
984
        $inlineMessageId = null
985
    ) {
986
        return Message::fromResponse($this->call('editMessageReplyMarkup', [
987
            'chat_id' => $chatId,
988
            'message_id' => $messageId,
989
            'inline_message_id' => $inlineMessageId,
990
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
991
        ]));
992
    }
993
994
    /**
995
     * Close curl