Test Failed
Pull Request — master (#292)
by
unknown
02:00
created

Animation::setFileName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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', '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
     * Identifier for this file, which can be used to download or reuse the file
43
     *
44
     * @var string
45
     */
46
    protected $fileId;
47
48
    /**
49
     * Unique identifier for this file, which is supposed
50
     * to be thesame over time and for different bots.
51
     * Can't be used to download or reuse the file.
52
     *
53
     * @var string
54
     */
55
    protected $fileUniqueId;
56
57
    /**
58
     * Video width as defined by sender
59
     *
60
     * @var int
61
     */
62
    protected $width;
63
64
    /**
65
     * Video height as defined by sender
66
     *
67
     * @var int
68
     */
69
    protected $height;
70
71
    /**
72
     * Duration of the video in seconds as defined by sender
73
     *
74
     * @var int
75
     */
76
    protected $duration;
77
78
    /**
79
     * Video thumbnail
80
     *
81
     * @var PhotoSize
82
     */
83
    protected $thumb;
84
85
    /**
86
     * Optional. Animation thumbnail as defined by sender
87
     *
88
     * @var PhotoSize
89
     */
90
    protected $fileName;
91
92
    /**
93
     * Optional. Mime type of a file as defined by sender
94
     *
95
     * @var string
96
     */
97
    protected $mimeType;
98
99
    /**
100
     * Optional. File size
101
     *
102
     * @var int
103
     */
104
    protected $fileSize;
105
106
    /**
107
     * @return int
108
     */
109
    public function getDuration()
110
    {
111
        return $this->duration;
112
    }
113
114
    /**
115
     * @param int $duration
116
     *
117
     * @throws InvalidArgumentException
118
     */
119
    public function setDuration($duration)
120
    {
121
        if (is_integer($duration)) {
122
            $this->duration = $duration;
123
        } else {
124
            throw new InvalidArgumentException();
125
        }
126
    }
127
128
    /**
129
     * @return string
130
     */
131
    public function getFileId()
132
    {
133
        return $this->fileId;
134
    }
135
136
    /**
137
     * @param string $fileId
138
     */
139
    public function setFileId($fileId)
140
    {
141
        $this->fileId = $fileId;
142
    }
143
144
    /**
145
     * @return string
146
     */
147
    public function getFileUniqueId()
148
    {
149
        return $this->fileUniqueId;
150
    }
151
152
    /**
153
     * @param string $fileId
0 ignored issues
show
Bug introduced by
There is no parameter named $fileId. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
154
     */
155
    public function setFileUniqueId($fileUniqueId)
156
    {
157
        $this->fileUniqueId = $fileUniqueId;
158
    }
159
160
    /**
161
     * @return int
162
     */
163
    public function getFileSize()
164
    {
165
        return $this->fileSize;
166
    }
167
168
    /**
169
     * @param int $fileSize
170
     *
171
     * @throws InvalidArgumentException
172
     */
173
    public function setFileSize($fileSize)
174
    {
175
        if (is_integer($fileSize)) {
176
            $this->fileSize = $fileSize;
177
        } else {
178
            throw new InvalidArgumentException();
179
        }
180
    }
181
182
    /**
183
     * @return int
184
     */
185
    public function getHeight()
186
    {
187
        return $this->height;
188
    }
189
190
    /**
191
     * @param int $height
192
     *
193
     * @throws InvalidArgumentException
194
     */
195
    public function setHeight($height)
196
    {
197
        if (is_integer($height)) {
198
            $this->height = $height;
199
        } else {
200
            throw new InvalidArgumentException();
201
        }
202
    }
203
204
    /**
205
     * @return string
206
     */
207
    public function getMimeType()
208
    {
209
        return $this->mimeType;
210
    }
211
212
    /**
213
     * @param string $mimeType
214
     */
215
    public function setMimeType($mimeType)
216
    {
217
        $this->mimeType = $mimeType;
218
    }
219
220
    /**
221
     * @return PhotoSize
222
     */
223
    public function getThumb()
224
    {
225
        return $this->thumb;
226
    }
227
228
    /**
229
     * @param PhotoSize $thumb
230
     */
231
    public function setThumb(PhotoSize $thumb)
232
    {
233
        $this->thumb = $thumb;
234
    }
235
236
    /**
237
     * @return string $fileName
238
     */
239
    public function getFileName()
240
    {
241
        return $this->fileName;
242
    }
243
244
    /**
245
     * @param string $fileName
246
     */
247
    public function setFileName($fileName)
248
    {
249
        $this->fileName = $fileName;
0 ignored issues
show
Documentation Bug introduced by
It seems like $fileName of type string is incompatible with the declared type object<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...
250
    }
251
252
    /**
253
     * @return int
254
     */
255
    public function getWidth()
256
    {
257
        return $this->width;
258
    }
259
260
    /**
261
     * @param int $width
262
     *
263
     * @throws InvalidArgumentException
264
     */
265
    public function setWidth($width)
266
    {
267
        if (is_integer($width)) {
268
            $this->width = $width;
269
        } else {
270
            throw new InvalidArgumentException();
271
        }
272
    }
273
}
274