Completed
Push — master ( 588078...30ae0c )
by Nikolay
04:51 queued 02:15
created

AddStickerToSetMethod::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 8
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 5
crap 6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\Method;
6
7
use Greenplugin\TelegramBot\Method\Traits\EmojisVariableTrait;
8
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait;
9
use Greenplugin\TelegramBot\Type\InputFileType;
10
use Greenplugin\TelegramBot\Type\MaskPositionType;
11
12
/**
13
 * Class AddStickerToSetMethod.
14
 *
15
 * @see https://core.telegram.org/bots/api#addstickertoset
16
 */
17
class AddStickerToSetMethod
18
{
19
    use FillFromArrayTrait;
20
    use EmojisVariableTrait;
21
    /**
22
     * User identifier of sticker set owner.
23
     *
24
     * @var int
25
     */
26
    public $userId;
27
28
    /**
29
     * Sticker set name.
30
     *
31
     * @var string
32
     */
33
    public $name;
34
35
    /**
36
     * Png image with the sticker, must be up to 512 kilobytes in size,
37
     * dimensions must not exceed 512px, and either width or height must be exactly 512px.
38
     * Pass a file_id as a String to send a file that already exists on the Telegram servers,
39
     * pass an HTTP URL as a String for Telegram to get a file from the Internet,
40
     * or upload a new one using multipart/form-data.
41
     *
42
     * @var InputFileType|string
43
     */
44
    public $pngSticker;
45
46
    /**
47
     * Optional. A JSON-serialized object for position where the mask should be placed on faces.
48
     *
49
     * @var MaskPositionType|null
50
     */
51
    public $maskPosition;
52
53
    /**
54
     * AddStickerToSetMethod constructor.
55
     *
56
     * @param int                  $userId
57
     * @param string               $name
58
     * @param InputFileType|string $pngSticker
59
     * @param string               $emojis
60
     * @param array|null           $data
61
     *
62
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
63
     */
64
    public function __construct(int $userId, string $name, $pngSticker, string $emojis, array $data = null)
65
    {
66
        $this->userId = $userId;
67
        $this->name = $name;
68
        $this->pngSticker = $pngSticker;
69
        $this->emojis = $emojis;
70
        if ($data) {
71
            $this->fill($data);
72
        }
73
    }
74
}
75