Code Duplication    Length = 15-19 lines in 7 locations

src/BotApi.php 7 locations

@@ 330-348 (lines=19) @@
327
     * @return \TelegramBot\Api\Types\Message
328
     * @throws \TelegramBot\Api\Exception
329
     */
330
    public function sendContact(
331
        $chatId,
332
        $phoneNumber,
333
        $firstName,
334
        $lastName = null,
335
        $replyToMessageId = null,
336
        $replyMarkup = null,
337
        $disableNotification = false
338
    ) {
339
        return Message::fromResponse($this->call('sendContact', [
340
            'chat_id' => $chatId,
341
            'phone_number' => $phoneNumber,
342
            'first_name' => $firstName,
343
            'last_name' => $lastName,
344
            'reply_to_message_id' => $replyToMessageId,
345
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
346
            'disable_notification' => (bool)$disableNotification,
347
        ]));
348
    }
349
350
    /**
351
     * Use this method when you need to tell the user that something is happening on the bot's side.
@@ 473-489 (lines=17) @@
470
     * @return \TelegramBot\Api\Types\Message
471
     * @throws \TelegramBot\Api\Exception
472
     */
473
    public function sendLocation(
474
        $chatId,
475
        $latitude,
476
        $longitude,
477
        $replyToMessageId = null,
478
        $replyMarkup = null,
479
        $disableNotification = false
480
    ) {
481
        return Message::fromResponse($this->call('sendLocation', [
482
            'chat_id' => $chatId,
483
            'latitude' => $latitude,
484
            'longitude' => $longitude,
485
            'reply_to_message_id' => $replyToMessageId,
486
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
487
            'disable_notification' => (bool)$disableNotification,
488
        ]));
489
    }
490
491
    /**
492
     * Use this method to send information about a venue. On success, the sent Message is returned.
@@ 544-558 (lines=15) @@
541
     * @throws \TelegramBot\Api\InvalidArgumentException
542
     * @throws \TelegramBot\Api\Exception
543
     */
544
    public function sendSticker(
545
        $chatId,
546
        $sticker,
547
        $replyToMessageId = null,
548
        $replyMarkup = null,
549
        $disableNotification = false
550
    ) {
551
        return Message::fromResponse($this->call('sendSticker', [
552
            'chat_id' => $chatId,
553
            'sticker' => $sticker,
554
            'reply_to_message_id' => $replyToMessageId,
555
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
556
            'disable_notification' => (bool)$disableNotification,
557
        ]));
558
    }
559
560
    /**
561
     * Use this method to send video files,
@@ 616-632 (lines=17) @@
613
     * @throws \TelegramBot\Api\InvalidArgumentException
614
     * @throws \TelegramBot\Api\Exception
615
     */
616
    public function sendVoice(
617
        $chatId,
618
        $voice,
619
        $duration = null,
620
        $replyToMessageId = null,
621
        $replyMarkup = null,
622
        $disableNotification = false
623
    ) {
624
        return Message::fromResponse($this->call('sendVoice', [
625
            'chat_id' => $chatId,
626
            'voice' => $voice,
627
            'duration' => $duration,
628
            'reply_to_message_id' => $replyToMessageId,
629
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
630
            'disable_notification' => (bool)$disableNotification,
631
        ]));
632
    }
633
634
    /**
635
     * Use this method to forward messages of any kind. On success, the sent Message is returned.
@@ 721-737 (lines=17) @@
718
     * @throws \TelegramBot\Api\InvalidArgumentException
719
     * @throws \TelegramBot\Api\Exception
720
     */
721
    public function sendPhoto(
722
        $chatId,
723
        $photo,
724
        $caption = null,
725
        $replyToMessageId = null,
726
        $replyMarkup = null,
727
        $disableNotification = false
728
    ) {
729
        return Message::fromResponse($this->call('sendPhoto', [
730
            'chat_id' => $chatId,
731
            'photo' => $photo,
732
            'caption' => $caption,
733
            'reply_to_message_id' => $replyToMessageId,
734
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
735
            'disable_notification' => (bool)$disableNotification,
736
        ]));
737
    }
738
739
    /**
740
     * Use this method to send general files. On success, the sent Message is returned.
@@ 753-767 (lines=15) @@
750
     * @throws \TelegramBot\Api\InvalidArgumentException
751
     * @throws \TelegramBot\Api\Exception
752
     */
753
    public function sendDocument(
754
        $chatId,
755
        $document,
756
        $replyToMessageId = null,
757
        $replyMarkup = null,
758
        $disableNotification = false
759
    ) {
760
        return Message::fromResponse($this->call('sendDocument', [
761
            'chat_id' => $chatId,
762
            'document' => $document,
763
            'reply_to_message_id' => $replyToMessageId,
764
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
765
            'disable_notification' => (bool)$disableNotification,
766
        ]));
767
    }
768
769
    /**
770
     * Use this method to get basic info about a file and prepare it for downloading.
@@ 914-930 (lines=17) @@
911
     * @throws \TelegramBot\Api\InvalidArgumentException
912
     * @throws \TelegramBot\Api\Exception
913
     */
914
    public function editMessageText(
915
        $chatId,
916
        $messageId,
917
        $text,
918
        $parseMode = null,
919
        $disablePreview = false,
920
        $replyMarkup = null
921
    ) {
922
        return Message::fromResponse($this->call('editMessageText', [
923
            'chat_id' => $chatId,
924
            'message_id' => $messageId,
925
            'text' => $text,
926
            'parse_mode' => $parseMode,
927
            'disable_web_page_preview' => $disablePreview,
928
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
929
        ]));
930
    }
931
932
    /**
933
     * Use this method to edit text messages sent by the bot or via the bot