MessageAnimation::getAnimation()   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
 * An animation message (GIF-style).
13
 */
14
class MessageAnimation extends MessageContent
15
{
16
    public const TYPE_NAME = 'messageAnimation';
17
18
    /**
19
     * The animation description.
20
     */
21
    protected Animation $animation;
22
23
    /**
24
     * Animation caption.
25
     */
26
    protected FormattedText $caption;
27
28
    /**
29
     * True, if the animation thumbnail must be blurred and the animation must be shown only while tapped.
30
     */
31
    protected bool $isSecret;
32
33
    public function __construct(Animation $animation, FormattedText $caption, bool $isSecret)
34
    {
35
        parent::__construct();
36
37
        $this->animation = $animation;
38
        $this->caption   = $caption;
39
        $this->isSecret  = $isSecret;
40
    }
41
42
    public static function fromArray(array $array): MessageAnimation
43
    {
44
        return new static(
45
            TdSchemaRegistry::fromArray($array['animation']),
46
            TdSchemaRegistry::fromArray($array['caption']),
47
            $array['is_secret'],
48
        );
49
    }
50
51
    public function typeSerialize(): array
52
    {
53
        return [
54
            '@type'     => static::TYPE_NAME,
55
            'animation' => $this->animation->typeSerialize(),
56
            'caption'   => $this->caption->typeSerialize(),
57
            'is_secret' => $this->isSecret,
58
        ];
59
    }
60
61
    public function getAnimation(): Animation
62
    {
63
        return $this->animation;
64
    }
65
66
    public function getCaption(): FormattedText
67
    {
68
        return $this->caption;
69
    }
70
71
    public function getIsSecret(): bool
72
    {
73
        return $this->isSecret;
74
    }
75
}
76