Passed
Push — master ( 3bfee0...112fc6 )
by Nikolay
02:02
created

GetUserProfilePhotosMethod::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
8
use TgBotApi\BotApiBase\Method\Traits\UserIdVariableTrait;
9
10
/**
11
 * Class GetUserProfilePhotosMethod.
12
 *
13
 * @see https://core.telegram.org/bots/api#getuserprofilephotos
14
 */
15
class GetUserProfilePhotosMethod
16
{
17
    use FillFromArrayTrait;
18
    use UserIdVariableTrait;
19
20
    /**
21
     * Optional. Sequential number of the first photo to be returned. By default, all photos are returned.
22
     *
23
     * @var int|null
24
     */
25
    public $offset;
26
27
    /**
28
     * Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.
29
     *
30
     * @var int|null
31
     */
32
    public $limit;
33
34
    /**
35
     * GetUserProfilePhotosMethod constructor.
36
     *
37
     * @param int        $userId
38
     * @param array|null $data
39
     *
40
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
41
     *
42
     * @return GetUserProfilePhotosMethod
43
     */
44 6
    public static function create(int $userId, array $data = null): GetUserProfilePhotosMethod
45
    {
46 6
        $instance = new static();
47 6
        $instance->userId = $userId;
48 6
        if ($data) {
49 3
            $instance->fill($data);
50
        }
51
52 6
        return $instance;
53
    }
54
}
55