Passed
Push — master ( 59a435...62cb7b )
by Nikolay
11:22
created

SendChatActionMethod::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
use TgBotApi\BotApiBase\Method\Interfaces\HasActionVariableInterface;
8
use TgBotApi\BotApiBase\Method\Traits\ChatIdVariableTrait;
9
10
/**
11
 * Class SendChatActionMethod.
12
 *
13
 * @see https://core.telegram.org/bots/api#sendchataction
14
 */
15
class SendChatActionMethod implements HasActionVariableInterface
16
{
17
    use ChatIdVariableTrait;
18
19
    /**
20
     * Type of action to broadcast.
21
     * Choose one, depending on what the user is about to receive:
22
     * typing for text messages,
23
     * upload_photo for photos,
24
     * record_video or upload_video for videos,
25
     * record_audio or upload_audio for audio files,
26
     * upload_document for general files,
27
     * find_location for location data,
28
     * record_video_note or upload_video_note for video notes.
29
     *
30
     * @var string
31
     */
32
    public $action;
33
34
    /**
35
     * @param int|string $chatId
36
     * @param string     $action
37
     *
38
     * @return SendChatActionMethod
39
     */
40 1
    public static function create($chatId, string $action): SendChatActionMethod
41
    {
42 1
        $instance = new static();
43 1
        $instance->chatId = $chatId;
44 1
        $instance->action = $action;
45
46 1
        return $instance;
47
    }
48
}
49