SendStickerMethod   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 34
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
use TgBotApi\BotApiBase\Method\Interfaces\SendMethodAliasInterface;
8
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
9
use TgBotApi\BotApiBase\Method\Traits\SendToChatVariablesTrait;
10
use TgBotApi\BotApiBase\Type\InputFileType;
11
12
/**
13
 * Class SendStickerMethod.
14
 *
15
 * @see https://core.telegram.org/bots/api#sendsticker
16
 */
17
class SendStickerMethod implements SendMethodAliasInterface
18
{
19
    use FillFromArrayTrait;
20
    use SendToChatVariablesTrait;
21
22
    /**
23
     * Sticker to send.
24
     * Pass a file_id as String to send a file that exists on the Telegram servers (recommended),
25
     * pass an HTTP URL as a String for Telegram to get a .webp file from the Internet,
26
     * or upload a new one using multipart/form-data.
27
     *
28
     * @var InputFileType|string
29
     */
30
    public $sticker;
31
32
    /**
33
     * @param int|string           $chatId
34
     * @param InputFileType|string $sticker
35
     * @param array|null           $data
36
     *
37
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
38
     *
39
     * @return SendStickerMethod
40
     */
41 1
    public static function create($chatId, $sticker, array $data = null): SendStickerMethod
42
    {
43 1
        $instance = new static();
44 1
        $instance->chatId = $chatId;
45 1
        $instance->sticker = $sticker;
46 1
        if ($data) {
47 1
            $instance->fill($data);
48
        }
49
50 1
        return $instance;
51
    }
52
}
53