GetUserProfilePhotosMethod::create()   A
last analyzed

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\Interfaces\MethodInterface;
8
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait;
9
use TgBotApi\BotApiBase\Method\Traits\UserIdVariableTrait;
10
11
/**
12
 * Class GetUserProfilePhotosMethod.
13
 *
14
 * @see https://core.telegram.org/bots/api#getuserprofilephotos
15
 */
16
class GetUserProfilePhotosMethod implements MethodInterface
17
{
18
    use FillFromArrayTrait;
19
    use UserIdVariableTrait;
20
21
    /**
22
     * Optional. Sequential number of the first photo to be returned. By default, all photos are returned.
23
     *
24
     * @var int|null
25
     */
26
    public $offset;
27
28
    /**
29
     * Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.
30
     *
31
     * @var int|null
32
     */
33
    public $limit;
34
35
    /**
36
     * GetUserProfilePhotosMethod constructor.
37
     *
38
     * @param int        $userId
39
     * @param array|null $data
40
     *
41
     * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
42
     *
43
     * @return GetUserProfilePhotosMethod
44
     */
45 2
    public static function create(int $userId, array $data = null): GetUserProfilePhotosMethod
46
    {
47 2
        $instance = new static();
48 2
        $instance->userId = $userId;
49 2
        if ($data) {
50 1
            $instance->fill($data);
51
        }
52
53 2
        return $instance;
54
    }
55
}
56