Passed
Push — draft ( 8ec7b9...aebf0a )
by Nikolay
03:09
created

GetUserProfilePhotosMethod::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 9
ccs 0
cts 6
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\Method;
6
7
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait;
8
use Greenplugin\TelegramBot\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 \Greenplugin\TelegramBot\Exception\BadArgumentException
41
     *
42
     * @return GetUserProfilePhotosMethod
43
     */
44
    public static function create(int $userId, array $data = null): GetUserProfilePhotosMethod
45
    {
46
        $instance = new static();
47
        $instance->userId = $userId;
48
        if ($data) {
49
            $instance->fill($data);
50
        }
51
52
        return $instance;
53
    }
54
}
55