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.
@@ 571-589 (lines=19) @@
568
     * @throws \TelegramBot\Api\InvalidArgumentException
569
     * @throws \TelegramBot\Api\Exception
570
     */
571
    public function sendAudio(
572
        $chatId,
573
        $audio,
574
        $duration = null,
575
        $performer = null,
576
        $title = null,
577
        $replyToMessageId = null,
578
        $replyMarkup = null
579
    ) {
580
        return Message::fromResponse($this->call('sendAudio', [
581
            'chat_id' => $chatId,
582
            'audio' => $audio,
583
            'duration' => $duration,
584
            'performer' => $performer,
585
            'title' => $title,
586
            'reply_to_message_id' => $replyToMessageId,
587
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson()
588
        ]));
589
    }
590
591
    /**
592
     * Use this method to send photos. On success, the sent Message is returned.
@@ 604-613 (lines=10) @@
601
     * @throws \TelegramBot\Api\InvalidArgumentException
602
     * @throws \TelegramBot\Api\Exception
603
     */
604
    public function sendPhoto($chatId, $photo, $caption = null, $replyToMessageId = null, $replyMarkup = null)
605
    {
606
        return Message::fromResponse($this->call('sendPhoto', [
607
            'chat_id' => $chatId,
608
            'photo' => $photo,
609
            'caption' => $caption,
610
            'reply_to_message_id' => $replyToMessageId,
611
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson()
612
        ]));
613
    }
614
615
    /**
616
     * Use this method to send general files. On success, the sent Message is returned.