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

Video::getMimeType()   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 Video
11
 * This object represents a video file.
12
 *
13
 * @package TelegramBot\Api\Types
14
 */
15
class Video extends BaseType implements TypeInterface
16
{
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @var array
21
     */
22
    static protected $requiredParams = ['file_id', 'file_unique_id', 'width', 'height', 'duration'];
23
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * @var array
28
     */
29
    static protected $map = [
30
        'file_id' => true,
31
        'file_unique_id' => true,
32
        'width' => true,
33
        'height' => true,
34
        'duration' => true,
35
        'thumb' => PhotoSize::class,
36
        'mime_type' => true,
37
        'file_size' => true
38
    ];
39
40
    /**
41
     * Unique identifier for this file
42
     *
43
     * @var string
44
     */
45
    protected $fileId;
46
47
    /**
48
     * Video width as defined by sender
49
     *
50
     * @var int
51
     */
52
    protected $width;
53
54
    /**
55
     * Video height as defined by sender
56
     *
57
     * @var int
58
     */
59
    protected $height;
60
61
    /**
62
     * Duration of the video in seconds as defined by sender
63
     *
64
     * @var int
65
     */
66
    protected $duration;
67
68
    /**
69
     * Video thumbnail
70
     *
71
     * @var PhotoSize
72
     */
73
    protected $thumb;
74
75
76
    /**
77
     * Optional. Mime type of a file as defined by sender
78
     *
79
     * @var string
80
     */
81
    protected $mimeType;
82
83
    /**
84
     * Optional. File size
85
     *
86
     * @var int
87
     */
88
    protected $fileSize;
89
90
    /**
91
     * 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.
92
     *
93
     * @var string
94
     */
95
    protected $fileUniqueId;
96
97
    /**
98
     * @return int
99
     */
100 1
    public function getDuration()
101
    {
102 1
        return $this->duration;
103
    }
104
105
    /**
106
     * @param int $duration
107
     *
108
     * @throws InvalidArgumentException
109
     */
110 6
    public function setDuration($duration)
111
    {
112 6
        if (is_integer($duration)) {
0 ignored issues
show
introduced by
The condition is_integer($duration) is always true.
Loading history...
113 5
            $this->duration = $duration;
114 5
        } else {
115 1
            throw new InvalidArgumentException();
116
        }
117 5
    }
118
119
    /**
120
     * @return string
121
     */
122 1
    public function getFileId()
123
    {
124 1
        return $this->fileId;
125
    }
126
127
    /**
128
     * @param string $fileId
129
     */
130 5
    public function setFileId($fileId)
131
    {
132 5
        $this->fileId = $fileId;
133 5
    }
134
135
    /**
136
     * @return int
137
     */
138 1
    public function getFileSize()
139
    {
140 1
        return $this->fileSize;
141
    }
142
143
    /**
144
     * @param int $fileSize
145
     *
146
     * @throws InvalidArgumentException
147
     */
148 6
    public function setFileSize($fileSize)
149
    {
150 6
        if (is_integer($fileSize)) {
0 ignored issues
show
introduced by
The condition is_integer($fileSize) is always true.
Loading history...
151 5
            $this->fileSize = $fileSize;
152 5
        } else {
153 1
            throw new InvalidArgumentException();
154
        }
155 5
    }
156
157
    /**
158
     * @return int
159
     */
160 1
    public function getHeight()
161
    {
162 1
        return $this->height;
163
    }
164
165
    /**
166
     * @param int $height
167
     *
168
     * @throws InvalidArgumentException
169
     */
170 6
    public function setHeight($height)
171
    {
172 6
        if (is_integer($height)) {
0 ignored issues
show
introduced by
The condition is_integer($height) is always true.
Loading history...
173 5
            $this->height = $height;
174 5
        } else {
175 1
            throw new InvalidArgumentException();
176
        }
177 5
    }
178
179
    /**
180
     * @return string
181
     */
182 1
    public function getMimeType()
183
    {
184 1
        return $this->mimeType;
185
    }
186
187
    /**
188
     * @param string $mimeType
189
     */
190 5
    public function setMimeType($mimeType)
191
    {
192 5
        $this->mimeType = $mimeType;
193 5
    }
194
195
    /**
196
     * @return PhotoSize
197
     */
198 2
    public function getThumb()
199
    {
200 2
        return $this->thumb;
201
    }
202
203
    /**
204
     * @param PhotoSize $thumb
205
     */
206 5
    public function setThumb(PhotoSize $thumb)
207
    {
208 5
        $this->thumb = $thumb;
209 5
    }
210
211
    /**
212
     * @return int
213
     */
214 1
    public function getWidth()
215
    {
216 1
        return $this->width;
217
    }
218
219
    /**
220
     * @param int $width
221
     *
222
     * @throws InvalidArgumentException
223
     */
224 6
    public function setWidth($width)
225
    {
226 6
        if (is_integer($width)) {
0 ignored issues
show
introduced by
The condition is_integer($width) is always true.
Loading history...
227 5
            $this->width = $width;
228 5
        } else {
229 1
            throw new InvalidArgumentException();
230
        }
231 5
    }
232
233
    /**
234
     * @return string
235
     */
236
    public function getFileUniqueId()
237
    {
238
        return $this->fileUniqueId;
239
    }
240
241
    /**
242
     * @param string $fileUniqueId
243
     */
244 3
    public function setFileUniqueId($fileUniqueId)
245
    {
246 3
        $this->fileUniqueId = $fileUniqueId;
247 3
    }
248
}
249