Completed
Push — master ( 9f5987...1ab7f6 )
by Camilo
02:23
created

Animation::mapSubObjects()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 2
dl 0
loc 9
ccs 0
cts 4
cp 0
crap 6
rs 9.9666
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 an animation file (GIF or H.264/MPEG-4 AVC video without sound).
11
 *
12
 * Objects defined as-is June 2020, Bot API v4.9
13
 *
14
 * @see https://core.telegram.org/bots/api#animation
15
 */
16
class Animation extends TelegramTypes
17
{
18
    /**
19
     * Unique file identifier
20
     * @var string
21
     */
22
    public $file_id = '';
23
24
    /**
25
     * Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used
26
     * to download or reuse the file.
27
     *
28
     * @var string
29
     */
30
    public $file_unique_id = '';
31
32
    /**
33
     * Video width as defined by sender
34
     * @var int
35
     */
36
    public $width = 0;
37
38
    /**
39
     * Video height as defined by sender
40
     * @var int
41
     */
42
    public $height = 0;
43
44
    /**
45
     * Duration of the video in seconds as defined by sender
46
     * @var int
47
     */
48
    public $duration = 0;
49
50
    /**
51
     * Optional. Animation thumbnail as defined by sender
52
     * @var PhotoSize
53
     */
54
    public $thumb;
55
56
    /**
57
     * Optional. Original animation filename as defined by sender
58
     * @var int
59
     */
60
    public $file_name = '';
61
62
    /**
63
     * Optional. MIME type of the file as defined by sender
64
     * @var string
65
     */
66
    public $mime_type = '';
67
68
    /**
69
     * Optional. File size
70
     * @var int
71
     */
72
    public $file_size = 0;
73
74
    protected function mapSubObjects(string $key, array $data): TelegramTypes
75
    {
76
        switch ($key) {
77
            case 'thumb':
78
                return new PhotoSize($data, $this->logger);
79
        }
80
81
        return parent::mapSubObjects($key, $data);
82
    }
83
}
84