Code Duplication    Length = 19-19 lines in 8 locations

src/BotApi.php 8 locations

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