Code Duplication    Length = 17-19 lines in 5 locations

src/BotApi.php 5 locations

@@ 335-353 (lines=19) @@
332
     * @return \TelegramBot\Api\Types\Message
333
     * @throws \TelegramBot\Api\Exception
334
     */
335
    public function sendContact(
336
        $chatId,
337
        $phoneNumber,
338
        $firstName,
339
        $lastName = null,
340
        $replyToMessageId = null,
341
        $replyMarkup = null,
342
        $disableNotification = false
343
    ) {
344
        return Message::fromResponse($this->call('sendContact', [
345
            'chat_id' => $chatId,
346
            'phone_number' => $phoneNumber,
347
            'first_name' => $firstName,
348
            'last_name' => $lastName,
349
            'reply_to_message_id' => $replyToMessageId,
350
            'reply_markup' => $replyMarkup,
351
            'disable_notification' => (bool)$disableNotification,
352
        ]));
353
    }
354
355
    /**
356
     * Use this method when you need to tell the user that something is happening on the bot's side.
@@ 478-494 (lines=17) @@
475
     * @return \TelegramBot\Api\Types\Message
476
     * @throws \TelegramBot\Api\Exception
477
     */
478
    public function sendLocation(
479
        $chatId,
480
        $latitude,
481
        $longitude,
482
        $replyToMessageId = null,
483
        $replyMarkup = null,
484
        $disableNotification = false
485
    ) {
486
        return Message::fromResponse($this->call('sendLocation', [
487
            'chat_id' => $chatId,
488
            'latitude' => $latitude,
489
            'longitude' => $longitude,
490
            'reply_to_message_id' => $replyToMessageId,
491
            'reply_markup' => $replyMarkup,
492
            'disable_notification' => (bool)$disableNotification,
493
        ]));
494
    }
495
496
    /**
497
     * Use this method to send information about a venue. On success, the sent Message is returned.
@@ 621-637 (lines=17) @@
618
     * @throws \TelegramBot\Api\InvalidArgumentException
619
     * @throws \TelegramBot\Api\Exception
620
     */
621
    public function sendVoice(
622
        $chatId,
623
        $voice,
624
        $duration = null,
625
        $replyToMessageId = null,
626
        $replyMarkup = null,
627
        $disableNotification = false
628
    ) {
629
        return Message::fromResponse($this->call('sendVoice', [
630
            'chat_id' => $chatId,
631
            'voice' => $voice,
632
            'duration' => $duration,
633
            'reply_to_message_id' => $replyToMessageId,
634
            'reply_markup' => $replyMarkup,
635
            'disable_notification' => (bool)$disableNotification,
636
        ]));
637
    }
638
639
    /**
640
     * Use this method to forward messages of any kind. On success, the sent Message is returned.
@@ 726-742 (lines=17) @@
723
     * @throws \TelegramBot\Api\InvalidArgumentException
724
     * @throws \TelegramBot\Api\Exception
725
     */
726
    public function sendPhoto(
727
        $chatId,
728
        $photo,
729
        $caption = null,
730
        $replyToMessageId = null,
731
        $replyMarkup = null,
732
        $disableNotification = false
733
    ) {
734
        return Message::fromResponse($this->call('sendPhoto', [
735
            'chat_id' => $chatId,
736
            'photo' => $photo,
737
            'caption' => $caption,
738
            'reply_to_message_id' => $replyToMessageId,
739
            'reply_markup' => $replyMarkup,
740
            'disable_notification' => (bool)$disableNotification,
741
        ]));
742
    }
743
744
    /**
745
     * Use this method to send general files. On success, the sent Message is returned.
@@ 919-935 (lines=17) @@
916
     * @throws \TelegramBot\Api\InvalidArgumentException
917
     * @throws \TelegramBot\Api\Exception
918
     */
919
    public function editMessageText(
920
        $chatId,
921
        $messageId,
922
        $text,
923
        $parseMode = null,
924
        $disablePreview = false,
925
        $replyMarkup = null
926
    ) {
927
        return Message::fromResponse($this->call('editMessageText', [
928
            'chat_id' => $chatId,
929
            'message_id' => $messageId,
930
            'text' => $text,
931
            'parse_mode' => $parseMode,
932
            'disable_web_page_preview' => $disablePreview,
933
            'reply_markup' => $replyMarkup,
934
        ]));
935
    }
936
937
    /**
938
     * Use this method to edit text messages sent by the bot or via the bot