Code Duplication    Length = 10-11 lines in 5 locations

src/BotApi.php 5 locations

@@ 435-445 (lines=11) @@
432
     * @return \TelegramBot\Api\Types\Message
433
     * @throws \TelegramBot\Api\Exception
434
     */
435
    public function sendLocation($chatId, $latitude, $longitude, $replyToMessageId = null, $replyMarkup = null, $disableNotification = false)
436
    {
437
        return Message::fromResponse($this->call('sendLocation', [
438
            'chat_id' => $chatId,
439
            'latitude' => $latitude,
440
            'longitude' => $longitude,
441
            'reply_to_message_id' => $replyToMessageId,
442
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
443
            'disable_notification' => (bool) $disableNotification
444
        ]));
445
    }
446
447
    /**
448
     * Use this method to send .webp stickers. On success, the sent Message is returned.
@@ 460-469 (lines=10) @@
457
     * @throws \TelegramBot\Api\InvalidArgumentException
458
     * @throws \TelegramBot\Api\Exception
459
     */
460
    public function sendSticker($chatId, $sticker, $replyToMessageId = null, $replyMarkup = null, $disableNotification = false)
461
    {
462
        return Message::fromResponse($this->call('sendSticker', [
463
            'chat_id' => $chatId,
464
            'sticker' => $sticker,
465
            'reply_to_message_id' => $replyToMessageId,
466
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
467
            'disable_notification' => (bool) $disableNotification
468
        ]));
469
    }
470
471
    /**
472
     * Use this method to send video files,
@@ 527-537 (lines=11) @@
524
     * @throws \TelegramBot\Api\InvalidArgumentException
525
     * @throws \TelegramBot\Api\Exception
526
     */
527
    public function sendVoice($chatId, $voice, $duration = null, $replyToMessageId = null, $replyMarkup = null, $disableNotification = false)
528
    {
529
        return Message::fromResponse($this->call('sendVoice', [
530
            'chat_id' => $chatId,
531
            'voice' => $voice,
532
            'duration' => $duration,
533
            'reply_to_message_id' => $replyToMessageId,
534
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
535
            'disable_notification' => (bool) $disableNotification
536
        ]));
537
    }
538
539
    /**
540
     * Use this method to forward messages of any kind. On success, the sent Message is returned.
@@ 626-636 (lines=11) @@
623
     * @throws \TelegramBot\Api\InvalidArgumentException
624
     * @throws \TelegramBot\Api\Exception
625
     */
626
    public function sendPhoto($chatId, $photo, $caption = null, $replyToMessageId = null, $replyMarkup = null, $disableNotification = false)
627
    {
628
        return Message::fromResponse($this->call('sendPhoto', [
629
            'chat_id' => $chatId,
630
            'photo' => $photo,
631
            'caption' => $caption,
632
            'reply_to_message_id' => $replyToMessageId,
633
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
634
            'disable_notification' => (bool) $disableNotification
635
        ]));
636
    }
637
638
    /**
639
     * Use this method to send general files. On success, the sent Message is returned.
@@ 652-661 (lines=10) @@
649
     * @throws \TelegramBot\Api\InvalidArgumentException
650
     * @throws \TelegramBot\Api\Exception
651
     */
652
    public function sendDocument($chatId, $document, $replyToMessageId = null, $replyMarkup = null, $disableNotification = false)
653
    {
654
        return Message::fromResponse($this->call('sendDocument', [
655
            'chat_id' => $chatId,
656
            'document' => $document,
657
            'reply_to_message_id' => $replyToMessageId,
658
            'reply_markup' => is_null($replyMarkup) ? $replyMarkup : $replyMarkup->toJson(),
659
            'disable_notification' => (bool) $disableNotification
660
        ]));
661
    }
662
663
    /**
664
     * Use this method to get basic info about a file and prepare it for downloading.