Completed
Push — master ( aedb8a...d04b6a )
by Nikolay
05:04
created

UploadStickerFileMethod::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\UploadMethodAliasInterface;
8
use TgBotApi\BotApiBase\Type\InputFileType;
9
10
/**
11
 * Class UploadStickerFileMethod.
12
 *
13
 * Use this method to upload a .png file with a sticker for later use in createNewStickerSet
14
 * and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success.
15
 *
16
 * @see https://core.telegram.org/bots/api#uploadstickerfile
17
 */
18
class UploadStickerFileMethod implements UploadMethodAliasInterface
19
{
20
    /**
21
     * User identifier of sticker file owner.
22
     *
23
     * @var int
24
     */
25
    public $userId;
26
27
    /**
28
     * Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px,
29
     * and either width or height must be exactly 512px.
30
     *
31
     * @var InputFileType
32
     */
33
    public $pngSticker;
34
35
    /**
36
     * @param int           $userId
37
     * @param InputFileType $pngSticker
38
     *
39
     * @return UploadStickerFileMethod
40
     */
41 1
    public static function create(int $userId, InputFileType $pngSticker): UploadStickerFileMethod
42
    {
43 1
        $instance = new static();
44 1
        $instance->userId = $userId;
45 1
        $instance->pngSticker = $pngSticker;
46
47 1
        return $instance;
48
    }
49
}
50