Completed
Push — master ( e9be36...9488e8 )
by Camilo
04:57
created

Document   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 39
ccs 2
cts 2
cp 1
rs 10
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 general file (as opposed to photos, voice messages and audio files).
11
 *
12
 * Objects defined as-is july 2016
13
 *
14
 * @see https://core.telegram.org/bots/api#document
15
 */
16
class Document extends TelegramTypes
17
{
18
    /**
19
     * Unique identifier for this file
20
     * @var string
21
     */
22
    public $file_id = '';
23
24
    /**
25
     * Optional. Document thumbnail as defined by sender
26
     * @var PhotoSize
27
     */
28
    public $thumb = null;
29
30
    /**
31
     * Optional. Original filename as defined by sender
32
     * @var string
33
     */
34
    public $file_name = '';
35
36
    /**
37
     * Optional. MIME type of the file as defined by sender
38
     * @var string
39
     */
40
    public $mime_type = '';
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