Code Duplication    Length = 19-19 lines in 8 locations

src/BotApi.php 8 locations

@@ 309-327 (lines=19) @@
306
     * @throws \TelegramBot\Api\InvalidArgumentException
307
     * @throws \TelegramBot\Api\Exception
308
     */
309
    public function sendMessage(
310
        $chatId,
311
        $text,
312
        $parseMode = null,
313
        $disablePreview = false,
314
        $replyToMessageId = null,
315
        $replyMarkup = null,
316
        $disableNotification = false
317
    ) {
318
        return Message::fromResponse($this->call('sendMessage', [
319
            'chat_id' => $chatId,
320
            'text' => $text,
321
            'parse_mode' => $parseMode,
322
            'disable_web_page_preview' => $disablePreview,
323
            'reply_to_message_id' => (int)$replyToMessageId,
324
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
325
            'disable_notification' => (bool)$disableNotification,
326
        ]));
327
    }
328
329
    /**
330
     * Use this method to send phone contacts
@@ 344-362 (lines=19) @@
341
     * @return \TelegramBot\Api\Types\Message
342
     * @throws \TelegramBot\Api\Exception
343
     */
344
    public function sendContact(
345
        $chatId,
346
        $phoneNumber,
347
        $firstName,
348
        $lastName = null,
349
        $replyToMessageId = null,
350
        $replyMarkup = null,
351
        $disableNotification = false
352
    ) {
353
        return Message::fromResponse($this->call('sendContact', [
354
            'chat_id' => $chatId,
355
            'phone_number' => $phoneNumber,
356
            'first_name' => $firstName,
357
            'last_name' => $lastName,
358
            'reply_to_message_id' => $replyToMessageId,
359
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
360
            'disable_notification' => (bool)$disableNotification,
361
        ]));
362
    }
363
364
    /**
365
     * Use this method when you need to tell the user that something is happening on the bot's side.
@@ 488-506 (lines=19) @@
485
     * @param null|int                                                                $livePeriod
486
     * @return \TelegramBot\Api\Types\Message
487
     */
488
    public function sendLocation(
489
        $chatId,
490
        $latitude,
491
        $longitude,
492
        $replyToMessageId = null,
493
        $replyMarkup = null,
494
        $disableNotification = false,
495
        $livePeriod = null
496
    ) {
497
        return Message::fromResponse($this->call('sendLocation', [
498
            'chat_id'              => $chatId,
499
            'latitude'             => $latitude,
500
            'longitude'            => $longitude,
501
            'live_period'          => $livePeriod,
502
            'reply_to_message_id'  => $replyToMessageId,
503
            'reply_markup'         => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
504
            'disable_notification' => (bool)$disableNotification,
505
        ]));
506
    }
507
508
    /**
509
     * Use this method to edit live location messages sent by the bot or via the bot (for inline bots).
@@ 699-717 (lines=19) @@
696
     * @throws \TelegramBot\Api\InvalidArgumentException
697
     * @throws \TelegramBot\Api\Exception
698
     */
699
    public function sendVoice(
700
        $chatId,
701
        $voice,
702
        $duration = null,
703
        $replyToMessageId = null,
704
        $replyMarkup = null,
705
        $disableNotification = false,
706
        $parseMode = null
707
    ) {
708
        return Message::fromResponse($this->call('sendVoice', [
709
            'chat_id' => $chatId,
710
            'voice' => $voice,
711
            'duration' => $duration,
712
            'reply_to_message_id' => $replyToMessageId,
713
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
714
            'disable_notification' => (bool)$disableNotification,
715
            'parse_mode' => $parseMode
716
        ]));
717
    }
718
719
    /**
720
     * Use this method to forward messages of any kind. On success, the sent Message is returned.
@@ 812-830 (lines=19) @@
809
     * @throws \TelegramBot\Api\InvalidArgumentException
810
     * @throws \TelegramBot\Api\Exception
811
     */
812
    public function sendPhoto(
813
        $chatId,
814
        $photo,
815
        $caption = null,
816
        $replyToMessageId = null,
817
        $replyMarkup = null,
818
        $disableNotification = false,
819
        $parseMode = null
820
    ) {
821
        return Message::fromResponse($this->call('sendPhoto', [
822
            'chat_id' => $chatId,
823
            'photo' => $photo,
824
            'caption' => $caption,
825
            'reply_to_message_id' => $replyToMessageId,
826
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
827
            'disable_notification' => (bool)$disableNotification,
828
            'parse_mode' => $parseMode
829
        ]));
830
    }
831
832
    /**
833
     * Use this method to send general files. On success, the sent Message is returned.
@@ 849-867 (lines=19) @@
846
     * @throws \TelegramBot\Api\InvalidArgumentException
847
     * @throws \TelegramBot\Api\Exception
848
     */
849
    public function sendDocument(
850
        $chatId,
851
        $document,
852
        $caption = null,
853
        $replyToMessageId = null,
854
        $replyMarkup = null,
855
        $disableNotification = false,
856
        $parseMode = null
857
    ) {
858
        return Message::fromResponse($this->call('sendDocument', [
859
            'chat_id' => $chatId,
860
            'document' => $document,
861
            'caption' => $caption,
862
            'reply_to_message_id' => $replyToMessageId,
863
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
864
            'disable_notification' => (bool)$disableNotification,
865
            'parse_mode' => $parseMode
866
        ]));
867
    }
868
869
    /**
870
     * Use this method to get basic info about a file and prepare it for downloading.
@@ 1027-1045 (lines=19) @@
1024
     *        Types\ReplyKeyboardRemove|null $replyMarkup
1025
     * @return Message
1026
     */
1027
    public function editMessageText(
1028
        $chatId,
1029
        $messageId,
1030
        $text,
1031
        $parseMode = null,
1032
        $disablePreview = false,
1033
        $replyMarkup = null,
1034
        $inlineMessageId = null
1035
    ) {
1036
        return Message::fromResponse($this->call('editMessageText', [
1037
            'chat_id' => $chatId,
1038
            'message_id' => $messageId,
1039
            'text' => $text,
1040
            'inline_message_id' => $inlineMessageId,
1041
            'parse_mode' => $parseMode,
1042
            'disable_web_page_preview' => $disablePreview,
1043
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
1044
        ]));
1045
    }
1046
1047
    /**
1048
     * Use this method to edit text messages sent by the bot or via the bot
@@ 1619-1637 (lines=19) @@
1616
     * @throws \TelegramBot\Api\InvalidArgumentException
1617
     * @throws \TelegramBot\Api\Exception
1618
     */
1619
    public function sendVideoNote(
1620
        $chatId,
1621
        $videoNote,
1622
        $duration = null,
1623
        $length = null,
1624
        $replyToMessageId = null,
1625
        $replyMarkup = null,
1626
        $disableNotification = false
1627
    ) {
1628
        return Message::fromResponse($this->call('sendVideoNote', [
1629
            'chat_id' => $chatId,
1630
            'video_note' => $videoNote,
1631
            'duration' => $duration,
1632
            'length' => $length,
1633
            'reply_to_message_id' => $replyToMessageId,
1634
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
1635
            'disable_notification' => (bool)$disableNotification
1636
        ]));
1637
    }
1638
1639
    /**
1640
     * Use this method to send a group of photos or videos as an album.