Completed
Push — master ( 24b2c2...c2a3d2 )
by Camilo
11s
created

Audio::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 audio file to be treated as music by the Telegram clients
11
 *
12
 * Objects defined as-is july 2018
13
 *
14
 * @see https://core.telegram.org/bots/api#audio
15
 */
16
class Audio extends TelegramTypes
17
{
18
    /**
19
     * Unique identifier for this file
20
     * @var string
21
     */
22
    public $file_id = '';
23
24
    /**
25
     * Duration of the audio in seconds as defined by sender
26
     * @var int
27
     */
28
    public $duration = 0;
29
30
    /**
31
     * Optional. Performer of the audio as defined by sender or by audio tags
32
     * @var string
33
     */
34
    public $performer = '';
35
36
    /**
37
     * Optional. Title of the audio as defined by sender or by audio tags
38
     * @var string
39
     */
40
    public $title = '';
41
42
    /**
43
     * Optional. MIME type of the file as defined by sender
44
     * @var string
45
     */
46
    public $mime_type = '';
47
48
    /**
49
     * Optional. File size
50
     * @var int
51
     */
52
    public $file_size = 0;
53
54
    /**
55
     * Optional. Thumbnail of the album cover to which the music file belongs
56
     * @var PhotoSize
57
     */
58
    public $thumb;
59
60
    protected function mapSubObjects(string $key, array $data): TelegramTypes
61
    {
62
        switch ($key) {
63
            case 'thumb':
64
                return new PhotoSize($data, $this->logger);
65
        }
66
67
        return parent::mapSubObjects($key, $data);
68
    }
69
}
70