Code Duplication    Length = 10-17 lines in 8 locations

src/BotApi.php 8 locations

@@ 679-688 (lines=10) @@
676
     * @throws \TelegramBot\Api\InvalidArgumentException
677
     * @throws \TelegramBot\Api\Exception
678
     */
679
    public function sendDocument(
680
        $chatId,
681
        $document,
682
        $replyToMessageId = null,
683
        $replyMarkup = null,
684
        $disableNotification = false
685
    ) {
686
        return Message::fromResponse($this->call('sendDocument', [
687
            'chat_id' => $chatId,
688
            'document' => $document,
689
            'reply_to_message_id' => $replyToMessageId,
690
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
691
            'disable_notification' => (bool) $disableNotification
@@ 439-449 (lines=11) @@
436
     * @return \TelegramBot\Api\Types\Message
437
     * @throws \TelegramBot\Api\Exception
438
     */
439
    public function sendLocation(
440
        $chatId,
441
        $latitude,
442
        $longitude,
443
        $replyToMessageId = null,
444
        $replyMarkup = null,
445
        $disableNotification = false
446
    ) {
447
        return Message::fromResponse($this->call('sendLocation', [
448
            'chat_id' => $chatId,
449
            'latitude' => $latitude,
450
            'longitude' => $longitude,
451
            'reply_to_message_id' => $replyToMessageId,
452
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
@@ 470-479 (lines=10) @@
467
     * @throws \TelegramBot\Api\InvalidArgumentException
468
     * @throws \TelegramBot\Api\Exception
469
     */
470
    public function sendSticker(
471
        $chatId,
472
        $sticker,
473
        $replyToMessageId = null,
474
        $replyMarkup = null,
475
        $disableNotification = false
476
    ) {
477
        return Message::fromResponse($this->call('sendSticker', [
478
            'chat_id' => $chatId,
479
            'sticker' => $sticker,
480
            'reply_to_message_id' => $replyToMessageId,
481
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
482
            'disable_notification' => (bool) $disableNotification
@@ 542-552 (lines=11) @@
539
     * @throws \TelegramBot\Api\InvalidArgumentException
540
     * @throws \TelegramBot\Api\Exception
541
     */
542
    public function sendVoice(
543
        $chatId,
544
        $voice,
545
        $duration = null,
546
        $replyToMessageId = null,
547
        $replyMarkup = null,
548
        $disableNotification = false
549
    ) {
550
        return Message::fromResponse($this->call('sendVoice', [
551
            'chat_id' => $chatId,
552
            'voice' => $voice,
553
            'duration' => $duration,
554
            'reply_to_message_id' => $replyToMessageId,
555
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
@@ 647-657 (lines=11) @@
644
     * @throws \TelegramBot\Api\InvalidArgumentException
645
     * @throws \TelegramBot\Api\Exception
646
     */
647
    public function sendPhoto(
648
        $chatId,
649
        $photo,
650
        $caption = null,
651
        $replyToMessageId = null,
652
        $replyMarkup = null,
653
        $disableNotification = false
654
    ) {
655
        return Message::fromResponse($this->call('sendPhoto', [
656
            'chat_id' => $chatId,
657
            'photo' => $photo,
658
            'caption' => $caption,
659
            'reply_to_message_id' => $replyToMessageId,
660
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
@@ 839-855 (lines=17) @@
836
     * @throws \TelegramBot\Api\InvalidArgumentException
837
     * @throws \TelegramBot\Api\Exception
838
     */
839
    public function editMessageText(
840
        $chatId,
841
        $messageId,
842
        $text,
843
        $parseMode = null,
844
        $disablePreview = false,
845
        $replyMarkup = null
846
    ) {
847
        return Message::fromResponse($this->call('editMessageText', [
848
            'chat_id' => $chatId,
849
            'message_id' => $messageId,
850
            'text' => $text,
851
            'parse_mode' => $parseMode,
852
            'disable_web_page_preview' => $disablePreview,
853
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
854
        ]));
855
    }
856
857
    /**
858
     * Use this method to edit text messages sent by the bot or via the bot
@@ 869-881 (lines=13) @@
866
     * @throws \TelegramBot\Api\InvalidArgumentException
867
     * @throws \TelegramBot\Api\Exception
868
     */
869
    public function editMessageCaption(
870
        $chatId,
871
        $messageId,
872
        $caption = null,
873
        $replyMarkup = null
874
    ) {
875
        return Message::fromResponse($this->call('editMessageText', [
876
            'chat_id' => $chatId,
877
            'message_id' => $messageId,
878
            'caption' => $caption,
879
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
880
        ]));
881
    }
882
883
    /**
884
     * Use this method to edit only the reply markup of messages sent by the bot or via the bot
@@ 894-904 (lines=11) @@
891
     * @throws \TelegramBot\Api\InvalidArgumentException
892
     * @throws \TelegramBot\Api\Exception
893
     */
894
    public function editMessageReplyMarkup(
895
        $chatId,
896
        $messageId,
897
        $replyMarkup = null
898
    ) {
899
        return Message::fromResponse($this->call('editMessageText', [
900
            'chat_id' => $chatId,
901
            'message_id' => $messageId,
902
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
903
        ]));
904
    }
905
906
    /**
907
     * Close curl