Code Duplication    Length = 10-17 lines in 4 locations

src/BotApi.php 4 locations

@@ 431-440 (lines=10) @@
428
     * @return \TelegramBot\Api\Types\Message
429
     * @throws \TelegramBot\Api\Exception
430
     */
431
    public function sendLocation($chatId, $latitude, $longitude, $replyToMessageId = null, $replyMarkup = null)
432
    {
433
        return Message::fromResponse($this->call('sendLocation', [
434
            'chat_id' => (int) $chatId,
435
            'latitude' => $latitude,
436
            'longitude' => $longitude,
437
            'reply_to_message_id' => $replyToMessageId,
438
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson()
439
        ]));
440
    }
441
442
    /**
443
     * Use this method to send .webp stickers. On success, the sent Message is returned.
@@ 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' => (int) $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.
@@ 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' => (int) $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.
@@ 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.