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 send polling. On success, the sent \TelegramBot\Api\Types\Poll is returned.
@@ 881-899 (lines=19) @@
878
     * @throws \TelegramBot\Api\InvalidArgumentException
879
     * @throws \TelegramBot\Api\Exception
880
     */
881
    public function sendPhoto(
882
        $chatId,
883
        $photo,
884
        $caption = null,
885
        $replyToMessageId = null,
886
        $replyMarkup = null,
887
        $disableNotification = false,
888
        $parseMode = null
889
    ) {
890
        return Message::fromResponse($this->call('sendPhoto', [
891
            'chat_id' => $chatId,
892
            'photo' => $photo,
893
            'caption' => $caption,
894
            'reply_to_message_id' => $replyToMessageId,
895
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
896
            'disable_notification' => (bool)$disableNotification,
897
            'parse_mode' => $parseMode
898
        ]));
899
    }
900
901
    /**
902
     * Use this method to send general files. On success, the sent Message is returned.
@@ 918-936 (lines=19) @@
915
     * @throws \TelegramBot\Api\InvalidArgumentException
916
     * @throws \TelegramBot\Api\Exception
917
     */
918
    public function sendDocument(
919
        $chatId,
920
        $document,
921
        $caption = null,
922
        $replyToMessageId = null,
923
        $replyMarkup = null,
924
        $disableNotification = false,
925
        $parseMode = null
926
    ) {
927
        return Message::fromResponse($this->call('sendDocument', [
928
            'chat_id' => $chatId,
929
            'document' => $document,
930
            'caption' => $caption,
931
            'reply_to_message_id' => $replyToMessageId,
932
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
933
            'disable_notification' => (bool)$disableNotification,
934
            'parse_mode' => $parseMode
935
        ]));
936
    }
937
938
    /**
939
     * Use this method to get basic info about a file and prepare it for downloading.
@@ 1096-1114 (lines=19) @@
1093
     *        Types\ReplyKeyboardRemove|null $replyMarkup
1094
     * @return Message
1095
     */
1096
    public function editMessageText(
1097
        $chatId,
1098
        $messageId,
1099
        $text,
1100
        $parseMode = null,
1101
        $disablePreview = false,
1102
        $replyMarkup = null,
1103
        $inlineMessageId = null
1104
    ) {
1105
        return Message::fromResponse($this->call('editMessageText', [
1106
            'chat_id' => $chatId,
1107
            'message_id' => $messageId,
1108
            'text' => $text,
1109
            'inline_message_id' => $inlineMessageId,
1110
            'parse_mode' => $parseMode,
1111
            'disable_web_page_preview' => $disablePreview,
1112
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
1113
        ]));
1114
    }
1115
1116
    /**
1117
     * Use this method to edit text messages sent by the bot or via the bot
@@ 1687-1705 (lines=19) @@
1684
     * @throws \TelegramBot\Api\InvalidArgumentException
1685
     * @throws \TelegramBot\Api\Exception
1686
     */
1687
    public function sendVideoNote(
1688
        $chatId,
1689
        $videoNote,
1690
        $duration = null,
1691
        $length = null,
1692
        $replyToMessageId = null,
1693
        $replyMarkup = null,
1694
        $disableNotification = false
1695
    ) {
1696
        return Message::fromResponse($this->call('sendVideoNote', [
1697
            'chat_id' => $chatId,
1698
            'video_note' => $videoNote,
1699
            'duration' => $duration,
1700
            'length' => $length,
1701
            'reply_to_message_id' => $replyToMessageId,
1702
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
1703
            'disable_notification' => (bool)$disableNotification
1704
        ]));
1705
    }
1706
1707
    /**
1708
     * Use this method to send a group of photos or videos as an album.