UpdateNewShippingQuery   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 26
dl 0
loc 81
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getShippingAddress() 0 3 1
A typeSerialize() 0 8 1
A getId() 0 3 1
A fromArray() 0 7 1
A getSenderUserId() 0 3 1
A getInvoicePayload() 0 3 1
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
 * A new incoming shipping query; for bots only. Only for invoices with flexible price.
13
 */
14
class UpdateNewShippingQuery extends Update
15
{
16
    public const TYPE_NAME = 'updateNewShippingQuery';
17
18
    /**
19
     * Unique query identifier.
20
     *
21
     * @var string
22
     */
23
    protected string $id;
24
25
    /**
26
     * Identifier of the user who sent the query.
27
     *
28
     * @var int
29
     */
30
    protected int $senderUserId;
31
32
    /**
33
     * Invoice payload.
34
     *
35
     * @var string
36
     */
37
    protected string $invoicePayload;
38
39
    /**
40
     * User shipping address.
41
     *
42
     * @var Address
43
     */
44
    protected Address $shippingAddress;
45
46
    public function __construct(string $id, int $senderUserId, string $invoicePayload, Address $shippingAddress)
47
    {
48
        parent::__construct();
49
50
        $this->id              = $id;
51
        $this->senderUserId    = $senderUserId;
52
        $this->invoicePayload  = $invoicePayload;
53
        $this->shippingAddress = $shippingAddress;
54
    }
55
56
    public static function fromArray(array $array): UpdateNewShippingQuery
57
    {
58
        return new static(
59
            $array['id'],
60
            $array['sender_user_id'],
61
            $array['invoice_payload'],
62
            TdSchemaRegistry::fromArray($array['shipping_address']),
63
        );
64
    }
65
66
    public function typeSerialize(): array
67
    {
68
        return [
69
            '@type'            => static::TYPE_NAME,
70
            'id'               => $this->id,
71
            'sender_user_id'   => $this->senderUserId,
72
            'invoice_payload'  => $this->invoicePayload,
73
            'shipping_address' => $this->shippingAddress->typeSerialize(),
74
        ];
75
    }
76
77
    public function getId(): string
78
    {
79
        return $this->id;
80
    }
81
82
    public function getSenderUserId(): int
83
    {
84
        return $this->senderUserId;
85
    }
86
87
    public function getInvoicePayload(): string
88
    {
89
        return $this->invoicePayload;
90
    }
91
92
    public function getShippingAddress(): Address
93
    {
94
        return $this->shippingAddress;
95
    }
96
}
97