Code Duplication    Length = 17-19 lines in 5 locations

src/BotApi.php 5 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' => $replyMarkup,
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' => $replyMarkup,
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.
@@ 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' => $replyMarkup,
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' => $replyMarkup,
739
            'disable_notification' => (bool)$disableNotification,
740
        ]));
741
    }
742
743
    /**
744
     * Use this method to send general files. On success, the sent Message is returned.
@@ 918-934 (lines=17) @@
915
     * @throws \TelegramBot\Api\InvalidArgumentException
916
     * @throws \TelegramBot\Api\Exception
917
     */
918
    public function editMessageText(
919
        $chatId,
920
        $messageId,
921
        $text,
922
        $parseMode = null,
923
        $disablePreview = false,
924
        $replyMarkup = null
925
    ) {
926
        return Message::fromResponse($this->call('editMessageText', [
927
            'chat_id' => $chatId,
928
            'message_id' => $messageId,
929
            'text' => $text,
930
            'parse_mode' => $parseMode,
931
            'disable_web_page_preview' => $disablePreview,
932
            'reply_markup' => $replyMarkup,
933
        ]));
934
    }
935
936
    /**
937
     * Use this method to edit text messages sent by the bot or via the bot