Passed
Push — master ( 6910c8...e09651 )
by Alexander
06:49 queued 03:04
created

Animation::setHeight()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
ccs 0
cts 2
cp 0
rs 10
cc 2
nc 2
nop 1
crap 6
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 Animation
11
 * This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
12
 *
13
 * @package TelegramBot\Api\Types
14
 */
15
class Animation 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
        'file_name' => true,
37
        'mime_type' => true,
38
        'file_size' => true
39
    ];
40
41
    /**
42
     * Unique file identifier
43
     *
44
     * @var string
45
     */
46
    protected $fileId;
47
48
    /**
49
     * 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.
50
     *
51
     * @var string
52
     */
53
    protected $fileUniqueId;
54
55
    /**
56
     * Video width as defined by sender
57
     *
58
     * @var int
59
     */
60
    protected $width;
61
62
    /**
63
     * Video height as defined by sender
64
     *
65
     * @var int
66
     */
67
    protected $height;
68
69
    /**
70
     * Duration of the video in seconds as defined by sender
71
     *
72
     * @var int
73
     */
74
    protected $duration;
75
76
    /**
77
     * Video thumbnail
78
     *
79
     * @var PhotoSize
80
     */
81
    protected $thumb;
82
83
    /**
84
     * Optional. Animation thumbnail as defined by sender
85
     *
86
     * @var PhotoSize
87
     */
88
    protected $fileName;
89
90
    /**
91
     * Optional. Mime type of a file as defined by sender
92
     *
93
     * @var string
94
     */
95
    protected $mimeType;
96
97
    /**
98
     * Optional. File size
99
     *
100
     * @var int
101
     */
102
    protected $fileSize;
103
104
    /**
105
     * @return int
106
     */
107
    public function getDuration()
108
    {
109
        return $this->duration;
110
    }
111
112
    /**
113
     * @param int $duration
114
     *
115
     * @throws InvalidArgumentException
116
     */
117
    public function setDuration($duration)
118
    {
119
        if (is_integer($duration)) {
0 ignored issues
show
introduced by
The condition is_integer($duration) is always true.
Loading history...
120
            $this->duration = $duration;
121
        } else {
122
            throw new InvalidArgumentException();
123
        }
124
    }
125
126
    /**
127
     * @return string
128
     */
129
    public function getFileId()
130
    {
131
        return $this->fileId;
132
    }
133
134
    /**
135
     * @param string $fileId
136
     */
137
    public function setFileId($fileId)
138
    {
139
        $this->fileId = $fileId;
140
    }
141
142
    /**
143
     * @return string
144
     */
145
    public function getFileUniqueId()
146
    {
147
        return $this->fileUniqueId;
148
    }
149
150
    /**
151
     * @param string $fileUniqueId
152
     */
153
    public function setFileUniqueId($fileUniqueId)
154
    {
155
        $this->fileUniqueId = $fileUniqueId;
156
    }
157
158
    /**
159
     * @return int
160
     */
161
    public function getFileSize()
162
    {
163
        return $this->fileSize;
164
    }
165
166
    /**
167
     * @param int $fileSize
168
     *
169
     * @throws InvalidArgumentException
170
     */
171
    public function setFileSize($fileSize)
172
    {
173
        if (is_integer($fileSize)) {
0 ignored issues
show
introduced by
The condition is_integer($fileSize) is always true.
Loading history...
174
            $this->fileSize = $fileSize;
175
        } else {
176
            throw new InvalidArgumentException();
177
        }
178
    }
179
180
    /**
181
     * @return int
182
     */
183
    public function getHeight()
184
    {
185
        return $this->height;
186
    }
187
188
    /**
189
     * @param int $height
190
     *
191
     * @throws InvalidArgumentException
192
     */
193
    public function setHeight($height)
194
    {
195
        if (is_integer($height)) {
0 ignored issues
show
introduced by
The condition is_integer($height) is always true.
Loading history...
196
            $this->height = $height;
197
        } else {
198
            throw new InvalidArgumentException();
199
        }
200
    }
201
202
    /**
203
     * @return string
204
     */
205
    public function getMimeType()
206
    {
207
        return $this->mimeType;
208
    }
209
210
    /**
211
     * @param string $mimeType
212
     */
213
    public function setMimeType($mimeType)
214
    {
215
        $this->mimeType = $mimeType;
216
    }
217
218
    /**
219
     * @return PhotoSize
220
     */
221
    public function getThumb()
222
    {
223
        return $this->thumb;
224
    }
225
226
    /**
227
     * @param PhotoSize $thumb
228
     */
229
    public function setThumb(PhotoSize $thumb)
230
    {
231
        $this->thumb = $thumb;
232
    }
233
234
    /**
235
     * @return string $fileName
236
     */
237
    public function getFileName()
238
    {
239
        return $this->fileName;
240
    }
241
242
    /**
243
     * @param string $fileName
244
     */
245
    public function setFileName($fileName)
246
    {
247
        $this->fileName = $fileName;
0 ignored issues
show
Documentation Bug introduced by
It seems like $fileName of type string is incompatible with the declared type TelegramBot\Api\Types\PhotoSize of property $fileName.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
248
    }
249
250
    /**
251
     * @return int
252
     */
253
    public function getWidth()
254
    {
255
        return $this->width;
256
    }
257
258
    /**
259
     * @param int $width
260
     *
261
     * @throws InvalidArgumentException
262
     */
263
    public function setWidth($width)
264
    {
265
        if (is_integer($width)) {
0 ignored issues
show
introduced by
The condition is_integer($width) is always true.
Loading history...
266
            $this->width = $width;
267
        } else {
268
            throw new InvalidArgumentException();
269
        }
270
    }
271
}
272