Code Duplication    Length = 19-19 lines in 8 locations

src/BotApi.php 8 locations

@@ 321-339 (lines=19) @@
318
     * @throws \TelegramBot\Api\InvalidArgumentException
319
     * @throws \TelegramBot\Api\Exception
320
     */
321
    public function sendMessage(
322
        $chatId,
323
        $text,
324
        $parseMode = null,
325
        $disablePreview = false,
326
        $replyToMessageId = null,
327
        $replyMarkup = null,
328
        $disableNotification = false
329
    ) {
330
        return Message::fromResponse($this->call('sendMessage', [
331
            'chat_id' => $chatId,
332
            'text' => $text,
333
            'parse_mode' => $parseMode,
334
            'disable_web_page_preview' => $disablePreview,
335
            'reply_to_message_id' => (int)$replyToMessageId,
336
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
337
            'disable_notification' => (bool)$disableNotification,
338
        ]));
339
    }
340
341
    /**
342
     * Use this method to send phone contacts
@@ 356-374 (lines=19) @@
353
     * @return \TelegramBot\Api\Types\Message
354
     * @throws \TelegramBot\Api\Exception
355
     */
356
    public function sendContact(
357
        $chatId,
358
        $phoneNumber,
359
        $firstName,
360
        $lastName = null,
361
        $replyToMessageId = null,
362
        $replyMarkup = null,
363
        $disableNotification = false
364
    ) {
365
        return Message::fromResponse($this->call('sendContact', [
366
            'chat_id' => $chatId,
367
            'phone_number' => $phoneNumber,
368
            'first_name' => $firstName,
369
            'last_name' => $lastName,
370
            'reply_to_message_id' => $replyToMessageId,
371
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
372
            'disable_notification' => (bool)$disableNotification,
373
        ]));
374
    }
375
376
    /**
377
     * Use this method when you need to tell the user that something is happening on the bot's side.
@@ 500-518 (lines=19) @@
497
     * @param null|int                                                                $livePeriod
498
     * @return \TelegramBot\Api\Types\Message
499
     */
500
    public function sendLocation(
501
        $chatId,
502
        $latitude,
503
        $longitude,
504
        $replyToMessageId = null,
505
        $replyMarkup = null,
506
        $disableNotification = false,
507
        $livePeriod = null
508
    ) {
509
        return Message::fromResponse($this->call('sendLocation', [
510
            'chat_id'              => $chatId,
511
            'latitude'             => $latitude,
512
            'longitude'            => $longitude,
513
            'live_period'          => $livePeriod,
514
            'reply_to_message_id'  => $replyToMessageId,
515
            'reply_markup'         => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
516
            'disable_notification' => (bool)$disableNotification,
517
        ]));
518
    }
519
520
    /**
521
     * Use this method to edit live location messages sent by the bot or via the bot (for inline bots).
@@ 711-729 (lines=19) @@
708
     * @throws \TelegramBot\Api\InvalidArgumentException
709
     * @throws \TelegramBot\Api\Exception
710
     */
711
    public function sendVoice(
712
        $chatId,
713
        $voice,
714
        $duration = null,
715
        $replyToMessageId = null,
716
        $replyMarkup = null,
717
        $disableNotification = false,
718
        $parseMode = null
719
    ) {
720
        return Message::fromResponse($this->call('sendVoice', [
721
            'chat_id' => $chatId,
722
            'voice' => $voice,
723
            'duration' => $duration,
724
            'reply_to_message_id' => $replyToMessageId,
725
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
726
            'disable_notification' => (bool)$disableNotification,
727
            'parse_mode' => $parseMode
728
        ]));
729
    }
730
731
    /**
732
     * Use this method to forward messages of any kind. On success, the sent Message is returned.
@@ 824-842 (lines=19) @@
821
     * @throws \TelegramBot\Api\InvalidArgumentException
822
     * @throws \TelegramBot\Api\Exception
823
     */
824
    public function sendPhoto(
825
        $chatId,
826
        $photo,
827
        $caption = null,
828
        $replyToMessageId = null,
829
        $replyMarkup = null,
830
        $disableNotification = false,
831
        $parseMode = null
832
    ) {
833
        return Message::fromResponse($this->call('sendPhoto', [
834
            'chat_id' => $chatId,
835
            'photo' => $photo,
836
            'caption' => $caption,
837
            'reply_to_message_id' => $replyToMessageId,
838
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
839
            'disable_notification' => (bool)$disableNotification,
840
            'parse_mode' => $parseMode
841
        ]));
842
    }
843
844
    /**
845
     * Use this method to send general files. On success, the sent Message is returned.
@@ 861-879 (lines=19) @@
858
     * @throws \TelegramBot\Api\InvalidArgumentException
859
     * @throws \TelegramBot\Api\Exception
860
     */
861
    public function sendDocument(
862
        $chatId,
863
        $document,
864
        $caption = null,
865
        $replyToMessageId = null,
866
        $replyMarkup = null,
867
        $disableNotification = false,
868
        $parseMode = null
869
    ) {
870
        return Message::fromResponse($this->call('sendDocument', [
871
            'chat_id' => $chatId,
872
            'document' => $document,
873
            'caption' => $caption,
874
            'reply_to_message_id' => $replyToMessageId,
875
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
876
            'disable_notification' => (bool)$disableNotification,
877
            'parse_mode' => $parseMode
878
        ]));
879
    }
880
881
    /**
882
     * Use this method to get basic info about a file and prepare it for downloading.
@@ 1039-1057 (lines=19) @@
1036
     *        Types\ReplyKeyboardRemove|null $replyMarkup
1037
     * @return Message
1038
     */
1039
    public function editMessageText(
1040
        $chatId,
1041
        $messageId,
1042
        $text,
1043
        $parseMode = null,
1044
        $disablePreview = false,
1045
        $replyMarkup = null,
1046
        $inlineMessageId = null
1047
    ) {
1048
        return Message::fromResponse($this->call('editMessageText', [
1049
            'chat_id' => $chatId,
1050
            'message_id' => $messageId,
1051
            'text' => $text,
1052
            'inline_message_id' => $inlineMessageId,
1053
            'parse_mode' => $parseMode,
1054
            'disable_web_page_preview' => $disablePreview,
1055
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
1056
        ]));
1057
    }
1058
1059
    /**
1060
     * Use this method to edit text messages sent by the bot or via the bot
@@ 1630-1648 (lines=19) @@
1627
     * @throws \TelegramBot\Api\InvalidArgumentException
1628
     * @throws \TelegramBot\Api\Exception
1629
     */
1630
    public function sendVideoNote(
1631
        $chatId,
1632
        $videoNote,
1633
        $duration = null,
1634
        $length = null,
1635
        $replyToMessageId = null,
1636
        $replyMarkup = null,
1637
        $disableNotification = false
1638
    ) {
1639
        return Message::fromResponse($this->call('sendVideoNote', [
1640
            'chat_id' => $chatId,
1641
            'video_note' => $videoNote,
1642
            'duration' => $duration,
1643
            'length' => $length,
1644
            'reply_to_message_id' => $replyToMessageId,
1645
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
1646
            'disable_notification' => (bool)$disableNotification
1647
        ]));
1648
    }
1649
1650
    /**
1651
     * Use this method to send a group of photos or videos as an album.