Completed
Push — Helper ( 85a115...5a8248 )
by Nikolay
03:43
created

SetPassportDataErrorsMethod   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 7
dl 0
loc 32
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Method;
6
7
use TgBotApi\BotApiBase\Type\PassportElementError\PassportElementErrorType;
8
9
/**
10
 * Class SetPassportDataErrorsMethod.
11
 *
12
 * Informs a user that some of the Telegram Passport elements they provided contains errors.
13
 * The user will not be able to re-submit their Passport to you until the errors are fixed
14
 * (the contents of the field for which you returned the error must change). Returns True on success.
15
 *
16
 * Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason.
17
 * For example, if a birthday date seems invalid, a submitted document is blurry,
18
 * a scan shows evidence of tampering, etc.
19
 * Supply some details in the error message to make sure the user knows how to correct the issues.
20
 *
21
 * @see https://core.telegram.org/bots/api#setpassportdataerrors
22
 * @see https://core.telegram.org/passport
23
 */
24
class SetPassportDataErrorsMethod
25
{
26
    /**
27
     * User identifier.
28
     *
29
     * @var int
30
     */
31
    public $userId;
32
33
    /**
34
     * A JSON-serialized array describing the errors.
35
     *
36
     * @var PassportElementErrorType[]
37
     */
38
    public $errors;
39
40
    /**
41
     * SetPassportDataErrorsMethod constructor.
42
     *
43
     * @param int $userId
44
     * @param PassportElementErrorType[]
45
     * @param array $errors
46
     *
47
     * @return SetPassportDataErrorsMethod
48
     */
49 9
    public static function create(int $userId, array $errors): SetPassportDataErrorsMethod
50
    {
51 9
        $instance = new static();
52 9
        $instance->userId = $userId;
53 9
        $instance->errors = $errors;
54
55 9
        return $instance;
56
    }
57
}
58