Code Duplication    Length = 10-19 lines in 5 locations

src/BotApi.php 5 locations

@@ 291-307 (lines=17) @@
288
     * @throws \TelegramBot\Api\InvalidArgumentException
289
     * @throws \TelegramBot\Api\Exception
290
     */
291
    public function sendMessage(
292
        $chatId,
293
        $text,
294
        $parseMode = null,
295
        $disablePreview = false,
296
        $replyToMessageId = null,
297
        $replyMarkup = null
298
    ) {
299
        return Message::fromResponse($this->call('sendMessage', [
300
            'chat_id' => $chatId,
301
            'text' => $text,
302
            'parse_mode' => $parseMode,
303
            'disable_web_page_preview' => $disablePreview,
304
            'reply_to_message_id' => (int) $replyToMessageId,
305
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson()
306
        ]));
307
    }
308
309
    /**
310
     * Use this method when you need to tell the user that something is happening on the bot's side.
@@ 480-496 (lines=17) @@
477
     * @throws \TelegramBot\Api\InvalidArgumentException
478
     * @throws \TelegramBot\Api\Exception
479
     */
480
    public function sendVideo(
481
        $chatId,
482
        $video,
483
        $duration = null,
484
        $caption = null,
485
        $replyToMessageId = null,
486
        $replyMarkup = null
487
    ) {
488
        return Message::fromResponse($this->call('sendVideo', [
489
            'chat_id' => $chatId,
490
            'video' => $video,
491
            'duration' => $duration,
492
            'caption' => $caption,
493
            'reply_to_message_id' => $replyToMessageId,
494
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson()
495
        ]));
496
    }
497
498
    /**
499
     * Use this method to send audio files,
@@ 516-525 (lines=10) @@
513
     * @throws \TelegramBot\Api\InvalidArgumentException
514
     * @throws \TelegramBot\Api\Exception
515
     */
516
    public function sendVoice($chatId, $voice, $duration = null, $replyToMessageId = null, $replyMarkup = null)
517
    {
518
        return Message::fromResponse($this->call('sendVoice', [
519
            'chat_id' => $chatId,
520
            'voice' => $voice,
521
            'duration' => $duration,
522
            'reply_to_message_id' => $replyToMessageId,
523
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson()
524
        ]));
525
    }
526
527
    /**
528
     * Use this method to forward messages of any kind. On success, the sent Message is returned.
@@ 575-593 (lines=19) @@
572
     * @throws \TelegramBot\Api\InvalidArgumentException
573
     * @throws \TelegramBot\Api\Exception
574
     */
575
    public function sendAudio(
576
        $chatId,
577
        $audio,
578
        $duration = null,
579
        $performer = null,
580
        $title = null,
581
        $replyToMessageId = null,
582
        $replyMarkup = null
583
    ) {
584
        return Message::fromResponse($this->call('sendAudio', [
585
            'chat_id' => $chatId,
586
            'audio' => $audio,
587
            'duration' => $duration,
588
            'performer' => $performer,
589
            'title' => $title,
590
            'reply_to_message_id' => $replyToMessageId,
591
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson()
592
        ]));
593
    }
594
595
    /**
596
     * Use this method to send photos. On success, the sent Message is returned.
@@ 608-617 (lines=10) @@
605
     * @throws \TelegramBot\Api\InvalidArgumentException
606
     * @throws \TelegramBot\Api\Exception
607
     */
608
    public function sendPhoto($chatId, $photo, $caption = null, $replyToMessageId = null, $replyMarkup = null)
609
    {
610
        return Message::fromResponse($this->call('sendPhoto', [
611
            'chat_id' => $chatId,
612
            'photo' => $photo,
613
            'caption' => $caption,
614
            'reply_to_message_id' => $replyToMessageId,
615
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson()
616
        ]));
617
    }
618
619
    /**
620
     * Use this method to send general files. On success, the sent Message is returned.