Completed
Push — master ( 989005...ce143f )
by Camilo
04:43
created

ShippingQuery   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 38
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A mapSubObjects() 0 11 3
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace unreal4u\TelegramAPI\Telegram\Types;
6
7
use unreal4u\TelegramAPI\Abstracts\TelegramTypes;
8
9
/**
10
 * This object contains information about an incoming shipping query
11
 *
12
 * Objects defined as-is may 2017
13
 *
14
 * @see https://core.telegram.org/bots/api#shippingquery
15
 */
16
class ShippingQuery extends TelegramTypes
17
{
18
    /**
19
     * Unique query identifier
20
     * @var string
21
     */
22
    public $id = '';
23
24
    /**
25
     * User who sent the query
26
     * @var User
27
     */
28
    public $from;
29
30
    /**
31
     * Bot specified invoice payload
32
     * @var string
33
     */
34
    public $invoice_payload = '';
35
36
    /**
37
     * User specified shipping address
38
     * @var ShippingAddress
39
     */
40
    public $shipping_address;
41
42
    protected function mapSubObjects(string $key, array $data): TelegramTypes
43
    {
44
        switch ($key) {
45
            case 'from':
46
                return new User($data, $this->logger);
47
            case 'shipping_address':
48
                return new ShippingAddress($data, $this->logger);
49
        }
50
51
        return parent::mapSubObjects($key, $data);
52
    }
53
}
54