InputTextMessageContentType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 39
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 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
use TgBotApi\BotApiBase\Type\Traits\CaptionEntitiesFieldTrait;
10
11
/**
12
 * Class InputTextMessageContentType.
13
 *
14
 * @see https://core.telegram.org/bots/api#inputtextmessagecontent
15
 */
16
class InputTextMessageContentType extends InputMessageContentType implements HasParseModeVariableInterface
17
{
18
    use FillFromArrayTrait;
19
    use CaptionEntitiesFieldTrait;
20
21
    /**
22
     * Text of the message to be sent, 1-4096 characters.
23
     *
24
     * @var string
25
     */
26
    public $messageText;
27
28
    /**
29
     * Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic,
30
     * fixed-width text or inline URLs in your bot's message.
31
     *
32
     * @var string|null
33
     */
34
    public $parseMode;
35
36
    /**
37
     * Optional. Disables link previews for links in the sent message.
38
     *
39
     * @var bool|null
40
     */
41
    public $disableWebPagePreview;
42
43
    /**
44
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
45
     */
46 2
    public static function create(string $messageText, array $data = null): InputTextMessageContentType
47
    {
48 2
        $instance = new static();
49 2
        $instance->messageText = $messageText;
50 2
        if ($data) {
51 2
            $instance->fill($data);
52
        }
53
54 2
        return $instance;
55
    }
56
}
57