PushMessageContentLocation   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 5 1
A __construct() 0 6 1
A typeSerialize() 0 6 1
A getIsLive() 0 3 1
A getIsPinned() 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 message with a location.
13
 */
14
class PushMessageContentLocation extends PushMessageContent
15
{
16
    public const TYPE_NAME = 'pushMessageContentLocation';
17
18
    /**
19
     * True, if the location is live.
20
     *
21
     * @var bool
22
     */
23
    protected bool $isLive;
24
25
    /**
26
     * True, if the message is a pinned message with the specified content.
27
     *
28
     * @var bool
29
     */
30
    protected bool $isPinned;
31
32
    public function __construct(bool $isLive, bool $isPinned)
33
    {
34
        parent::__construct();
35
36
        $this->isLive   = $isLive;
37
        $this->isPinned = $isPinned;
38
    }
39
40
    public static function fromArray(array $array): PushMessageContentLocation
41
    {
42
        return new static(
43
            $array['is_live'],
44
            $array['is_pinned'],
45
        );
46
    }
47
48
    public function typeSerialize(): array
49
    {
50
        return [
51
            '@type'     => static::TYPE_NAME,
52
            'is_live'   => $this->isLive,
53
            'is_pinned' => $this->isPinned,
54
        ];
55
    }
56
57
    public function getIsLive(): bool
58
    {
59
        return $this->isLive;
60
    }
61
62
    public function getIsPinned(): bool
63
    {
64
        return $this->isPinned;
65
    }
66
}
67