Passed
Pull Request — master (#408)
by Alexander
01:42
created

Document::getThumb()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace TelegramBot\Api\Types;
4
5
use TelegramBot\Api\BaseType;
6
use TelegramBot\Api\InvalidArgumentException;
7
use TelegramBot\Api\TypeInterface;
8
9
/**
10
 * Class Document
11
 * This object represents a general file (as opposed to photos and audio files).
12
 * Telegram users can send files of any type of up to 1.5 GB in size.
13
 *
14
 * @package TelegramBot\Api\Types
15
 */
16
class Document extends BaseType implements TypeInterface
17
{
18
    /**
19
     * {@inheritdoc}
20
     *
21
     * @var array
22
     */
23
    static protected $map = [
24
        'file_id' => true,
25
        'file_unique_id' => true,
26
        'thumb' => PhotoSize::class,
27
        'file_name' => true,
28
        'mime_type' => true,
29
        'file_size' => true
30
    ];
31
32
    /**
33
     * {@inheritdoc}
34
     *
35
     * @var array
36
     */
37
    static protected $requiredParams = ['file_id', 'file_unique_id'];
38
39
    /**
40
     * Unique identifier for this file
41
     *
42
     * @var string
43
     */
44
    protected $fileId;
45
46
    /**
47
     * Document thumbnail as defined by sender
48
     *
49
     * @var PhotoSize
50
     */
51
    protected $thumb;
52
53
    /**
54
     * Optional. Original filename as defined by sender
55
     *
56
     * @var string
57
     */
58
    protected $fileName;
59
60
    /**
61
     * Optional. MIME type of the file as defined by sender
62
     *
63
     * @var string
64
     */
65
    protected $mimeType;
66
67
    /**
68
     * Optional. File size
69
     *
70
     * @var int
71
     */
72
    protected $fileSize;
73
74
    /**
75
     * Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
76
     *
77
     * @var string
78
     */
79
    protected $fileUniqueId;
80
81
    /**
82
     * @return string
83
     */
84 1
    public function getFileId()
85
    {
86 1
        return $this->fileId;
87
    }
88
89
    /**
90
     * @param string $fileId
91
     */
92 5
    public function setFileId($fileId)
93
    {
94 5
        $this->fileId = $fileId;
95 5
    }
96
97
    /**
98
     * @return string
99
     */
100 1
    public function getFileName()
101
    {
102 1
        return $this->fileName;
103
    }
104
105
    /**
106
     * @param string $fileName
107
     */
108 5
    public function setFileName($fileName)
109
    {
110 5
        $this->fileName = $fileName;
111 5
    }
112
113
    /**
114
     * @return int
115
     */
116 1
    public function getFileSize()
117
    {
118 1
        return $this->fileSize;
119
    }
120
121
    /**
122
     * @param int $fileSize
123
     *
124
     * @throws InvalidArgumentException
125
     */
126 6
    public function setFileSize($fileSize)
127
    {
128 6
        if (is_integer($fileSize)) {
0 ignored issues
show
introduced by
The condition is_integer($fileSize) is always true.
Loading history...
129 5
            $this->fileSize = $fileSize;
130 5
        } else {
131 1
            throw new InvalidArgumentException();
132
        }
133 5
    }
134
135
    /**
136
     * @return string
137
     */
138 1
    public function getMimeType()
139
    {
140 1
        return $this->mimeType;
141
    }
142
143
    /**
144
     * @param string $mimeType
145
     */
146 5
    public function setMimeType($mimeType)
147
    {
148 5
        $this->mimeType = $mimeType;
149 5
    }
150
151
    /**
152
     * @return PhotoSize
153
     */
154 2
    public function getThumb()
155
    {
156 2
        return $this->thumb;
157
    }
158
159
    /**
160
     * @param PhotoSize $thumb
161
     */
162 5
    public function setThumb(PhotoSize $thumb)
163
    {
164 5
        $this->thumb = $thumb;
165 5
    }
166
167
    /**
168
     * @return string
169
     */
170
    public function getFileUniqueId()
171
    {
172
        return $this->fileUniqueId;
173
    }
174
175
    /**
176
     * @param string $fileUniqueId
177
     */
178 3
    public function setFileUniqueId($fileUniqueId)
179
    {
180 3
        $this->fileUniqueId = $fileUniqueId;
181 3
    }
182
}
183