ChatEventLocationChanged::getNewLocation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
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 PHPTdGram\Schema;
10
11
/**
12
 * The supergroup location was changed.
13
 */
14
class ChatEventLocationChanged extends ChatEventAction
15
{
16
    public const TYPE_NAME = 'chatEventLocationChanged';
17
18
    /**
19
     * Previous location; may be null.
20
     */
21
    protected ?ChatLocation $oldLocation;
22
23
    /**
24
     * New location; may be null.
25
     */
26
    protected ?ChatLocation $newLocation;
27
28
    public function __construct(?ChatLocation $oldLocation, ?ChatLocation $newLocation)
29
    {
30
        parent::__construct();
31
32
        $this->oldLocation = $oldLocation;
33
        $this->newLocation = $newLocation;
34
    }
35
36
    public static function fromArray(array $array): ChatEventLocationChanged
37
    {
38
        return new static(
39
            (isset($array['old_location']) ? TdSchemaRegistry::fromArray($array['old_location']) : null),
40
            (isset($array['new_location']) ? TdSchemaRegistry::fromArray($array['new_location']) : null),
41
        );
42
    }
43
44
    public function typeSerialize(): array
45
    {
46
        return [
47
            '@type'        => static::TYPE_NAME,
48
            'old_location' => (isset($this->oldLocation) ? $this->oldLocation : null),
49
            'new_location' => (isset($this->newLocation) ? $this->newLocation : null),
50
        ];
51
    }
52
53
    public function getOldLocation(): ?ChatLocation
54
    {
55
        return $this->oldLocation;
56
    }
57
58
    public function getNewLocation(): ?ChatLocation
59
    {
60
        return $this->newLocation;
61
    }
62
}
63