Passed
Push — master ( c05883...1d5c29 )
by Nikolay
02:30
created

InputTextMessageContentType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 42
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
wmc 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Type\InputMessageContent;
6
7
use TgBotApi\BotApiBase\Method\Interfaces\HasParseModeVariableInterface;
8
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
9
10
/**
11
 * Class InputTextMessageContentType.
12
 *
13
 * @see https://core.telegram.org/bots/api#inputtextmessagecontent
14
 */
15
class InputTextMessageContentType extends InputMessageContentType implements HasParseModeVariableInterface
16
{
17
    use FillFromArrayTrait;
18
    /**
19
     * Text of the message to be sent, 1-4096 characters.
20
     *
21
     * @var string
22
     */
23
    public $messageText;
24
25
    /**
26
     * Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic,
27
     * fixed-width text or inline URLs in your bot's message.
28
     *
29
     * @var string|null
30
     */
31
    public $parseMode;
32
33
    /**
34
     * Optional. Disables link previews for links in the sent message.
35
     *
36
     * @var bool|null
37
     */
38
    public $disableWebPagePreview;
39
40
    /**
41
     * @param string     $messageText
42
     * @param array|null $data
43
     *
44
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
45
     *
46
     * @return InputTextMessageContentType
47
     */
48
    public static function create(string $messageText, array $data = null): InputTextMessageContentType
49
    {
50
        $instance = new static();
51
        $instance->messageText = $messageText;
52
        if ($data) {
53
            $instance->fill($data);
54
        }
55
56
        return $instance;
57
    }
58
}
59