Completed
Push — master ( 6275b0...de1a29 )
by Camilo
08:53
created

ProximityAlertTriggered::mapSubObjects()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 2
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
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 represents the content of a service message, sent whenever a user in the chat triggers a proximity alert
11
 * set by another user
12
 *
13
 * Objects defined as-is november 2020, Bot API v5.0
14
 *
15
 * @see https://core.telegram.org/bots/api#proximityalerttriggered
16
 */
17
class ProximityAlertTriggered extends TelegramTypes
18
{
19
    /**
20
     * User that triggered the alert
21
     * @var User
22
     */
23
    public $traveler;
24
25
    /**
26
     * User that set the alert
27
     * @var User
28
     */
29
    public $watcher;
30
31
    /**
32
     * The distance between the users
33
     * @var int
34
     */
35
    public $distance;
36
37
    protected function mapSubObjects(string $key, array $data): TelegramTypes
38
    {
39
        switch ($key) {
40
            case 'traveler':
41
            case 'watcher':
42
                return new User($data, $this->logger);
43
        }
44
45
        return parent::mapSubObjects($key, $data);
46
    }
47
}
48