GetPassportAuthorizationForm::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This phpFile is auto-generated.
5
 */
6
7
declare(strict_types=1);
8
9
namespace AurimasNiekis\TdLibSchema;
10
11
/**
12
 * Returns a Telegram Passport authorization form for sharing data with a service.
13
 */
14
class GetPassportAuthorizationForm extends TdFunction
15
{
16
    public const TYPE_NAME = 'getPassportAuthorizationForm';
17
18
    /**
19
     * User identifier of the service's bot.
20
     *
21
     * @var int
22
     */
23
    protected int $botUserId;
24
25
    /**
26
     * Telegram Passport element types requested by the service.
27
     *
28
     * @var string
29
     */
30
    protected string $scope;
31
32
    /**
33
     * Service's public_key.
34
     *
35
     * @var string
36
     */
37
    protected string $publicKey;
38
39
    /**
40
     * Authorization form nonce provided by the service.
41
     *
42
     * @var string
43
     */
44
    protected string $nonce;
45
46
    public function __construct(int $botUserId, string $scope, string $publicKey, string $nonce)
47
    {
48
        $this->botUserId = $botUserId;
49
        $this->scope     = $scope;
50
        $this->publicKey = $publicKey;
51
        $this->nonce     = $nonce;
52
    }
53
54
    public static function fromArray(array $array): GetPassportAuthorizationForm
55
    {
56
        return new static(
57
            $array['bot_user_id'],
58
            $array['scope'],
59
            $array['public_key'],
60
            $array['nonce'],
61
        );
62
    }
63
64
    public function typeSerialize(): array
65
    {
66
        return [
67
            '@type'       => static::TYPE_NAME,
68
            'bot_user_id' => $this->botUserId,
69
            'scope'       => $this->scope,
70
            'public_key'  => $this->publicKey,
71
            'nonce'       => $this->nonce,
72
        ];
73
    }
74
75
    public function getBotUserId(): int
76
    {
77
        return $this->botUserId;
78
    }
79
80
    public function getScope(): string
81
    {
82
        return $this->scope;
83
    }
84
85
    public function getPublicKey(): string
86
    {
87
        return $this->publicKey;
88
    }
89
90
    public function getNonce(): string
91
    {
92
        return $this->nonce;
93
    }
94
}
95