Completed
Push — master ( 989005...ce143f )
by Camilo
04:43
created

VideoNote::mapSubObjects()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 4
cp 0
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
crap 6
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 a video message (available in Telegram apps as of v.4.0).
11
 *
12
 * Objects defined as-is May 2017
13
 *
14
 * @see https://core.telegram.org/bots/api#videonote
15
 */
16
class VideoNote extends TelegramTypes
17
{
18
    /**
19
     * Unique identifier for this file
20
     * @var string
21
     */
22
    public $file_id = '';
23
24
    /**
25
     * Video width and height as defined by sender
26
     * @var int
27
     */
28
    public $length = 0;
29
30
    /**
31
     * Duration of the video in seconds as defined by sender
32
     * @var int
33
     */
34
    public $duration = 0;
35
36
    /**
37
     * Optional. Video thumbnail
38
     * @var PhotoSize
39
     */
40
    public $thumb;
41
42
    /**
43
     * Optional. File size
44
     * @var int
45
     */
46
    public $file_size = 0;
47
48
    protected function mapSubObjects(string $key, array $data): TelegramTypes
49
    {
50
        switch ($key) {
51
            case 'thumb':
52
                return new PhotoSize($data, $this->logger);
53
        }
54
55
        return parent::mapSubObjects($key, $data);
56
    }
57
}
58