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

ProximityAlertTriggered   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A mapSubObjects() 0 10 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 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