Code Duplication    Length = 10-19 lines in 9 locations

src/BotApi.php 9 locations

@@ 330-348 (lines=19) @@
327
     * @return \TelegramBot\Api\Types\Message
328
     * @throws \TelegramBot\Api\Exception
329
     */
330
    public function sendContact(
331
        $chatId,
332
        $phoneNumber,
333
        $firstName,
334
        $lastName = null,
335
        $replyToMessageId = null,
336
        $replyMarkup = null,
337
        $disableNotification = false
338
    ) {
339
        return Message::fromResponse($this->call('sendContact', [
340
            'chat_id' => $chatId,
341
            'phone_number' => $phoneNumber,
342
            'first_name' => $firstName,
343
            'last_name' => $lastName,
344
            'reply_to_message_id' => $replyToMessageId,
345
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
346
            'disable_notification' => (bool)$disableNotification,
347
        ]));
348
    }
349
350
    /**
351
     * Use this method when you need to tell the user that something is happening on the bot's side.
@@ 473-483 (lines=11) @@
470
     * @return \TelegramBot\Api\Types\Message
471
     * @throws \TelegramBot\Api\Exception
472
     */
473
    public function sendLocation(
474
        $chatId,
475
        $latitude,
476
        $longitude,
477
        $replyToMessageId = null,
478
        $replyMarkup = null,
479
        $disableNotification = false
480
    ) {
481
        return Message::fromResponse($this->call('sendLocation', [
482
            'chat_id' => $chatId,
483
            'latitude' => $latitude,
484
            'longitude' => $longitude,
485
            'reply_to_message_id' => $replyToMessageId,
486
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
@@ 504-513 (lines=10) @@
501
     * @throws \TelegramBot\Api\InvalidArgumentException
502
     * @throws \TelegramBot\Api\Exception
503
     */
504
    public function sendSticker(
505
        $chatId,
506
        $sticker,
507
        $replyToMessageId = null,
508
        $replyMarkup = null,
509
        $disableNotification = false
510
    ) {
511
        return Message::fromResponse($this->call('sendSticker', [
512
            'chat_id' => $chatId,
513
            'sticker' => $sticker,
514
            'reply_to_message_id' => $replyToMessageId,
515
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
516
            'disable_notification' => (bool) $disableNotification
@@ 576-586 (lines=11) @@
573
     * @throws \TelegramBot\Api\InvalidArgumentException
574
     * @throws \TelegramBot\Api\Exception
575
     */
576
    public function sendVoice(
577
        $chatId,
578
        $voice,
579
        $duration = null,
580
        $replyToMessageId = null,
581
        $replyMarkup = null,
582
        $disableNotification = false
583
    ) {
584
        return Message::fromResponse($this->call('sendVoice', [
585
            'chat_id' => $chatId,
586
            'voice' => $voice,
587
            'duration' => $duration,
588
            'reply_to_message_id' => $replyToMessageId,
589
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
@@ 681-691 (lines=11) @@
678
     * @throws \TelegramBot\Api\InvalidArgumentException
679
     * @throws \TelegramBot\Api\Exception
680
     */
681
    public function sendPhoto(
682
        $chatId,
683
        $photo,
684
        $caption = null,
685
        $replyToMessageId = null,
686
        $replyMarkup = null,
687
        $disableNotification = false
688
    ) {
689
        return Message::fromResponse($this->call('sendPhoto', [
690
            'chat_id' => $chatId,
691
            'photo' => $photo,
692
            'caption' => $caption,
693
            'reply_to_message_id' => $replyToMessageId,
694
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
@@ 713-722 (lines=10) @@
710
     * @throws \TelegramBot\Api\InvalidArgumentException
711
     * @throws \TelegramBot\Api\Exception
712
     */
713
    public function sendDocument(
714
        $chatId,
715
        $document,
716
        $replyToMessageId = null,
717
        $replyMarkup = null,
718
        $disableNotification = false
719
    ) {
720
        return Message::fromResponse($this->call('sendDocument', [
721
            'chat_id' => $chatId,
722
            'document' => $document,
723
            'reply_to_message_id' => $replyToMessageId,
724
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
725
            'disable_notification' => (bool) $disableNotification
@@ 874-890 (lines=17) @@
871
     * @throws \TelegramBot\Api\InvalidArgumentException
872
     * @throws \TelegramBot\Api\Exception
873
     */
874
    public function editMessageText(
875
        $chatId,
876
        $messageId,
877
        $text,
878
        $parseMode = null,
879
        $disablePreview = false,
880
        $replyMarkup = null
881
    ) {
882
        return Message::fromResponse($this->call('editMessageText', [
883
            'chat_id' => $chatId,
884
            'message_id' => $messageId,
885
            'text' => $text,
886
            'parse_mode' => $parseMode,
887
            'disable_web_page_preview' => $disablePreview,
888
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
889
        ]));
890
    }
891
892
    /**
893
     * Use this method to edit text messages sent by the bot or via the bot
@@ 904-916 (lines=13) @@
901
     * @throws \TelegramBot\Api\InvalidArgumentException
902
     * @throws \TelegramBot\Api\Exception
903
     */
904
    public function editMessageCaption(
905
        $chatId,
906
        $messageId,
907
        $caption = null,
908
        $replyMarkup = null
909
    ) {
910
        return Message::fromResponse($this->call('editMessageText', [
911
            'chat_id' => $chatId,
912
            'message_id' => $messageId,
913
            'caption' => $caption,
914
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
915
        ]));
916
    }
917
918
    /**
919
     * Use this method to edit only the reply markup of messages sent by the bot or via the bot
@@ 929-939 (lines=11) @@
926
     * @throws \TelegramBot\Api\InvalidArgumentException
927
     * @throws \TelegramBot\Api\Exception
928
     */
929
    public function editMessageReplyMarkup(
930
        $chatId,
931
        $messageId,
932
        $replyMarkup = null
933
    ) {
934
        return Message::fromResponse($this->call('editMessageText', [
935
            'chat_id' => $chatId,
936
            'message_id' => $messageId,
937
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
938
        ]));
939
    }
940
941
    /**
942
     * Close curl