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

Video::getHeight()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
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', '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
     * Identifier for this file, which can be used to download or reuse the file
42
     *
43
     * @var string
44
     */
45
    protected $fileId;
46
47
    /**
48
     * Unique identifier for this file, which is supposed
49
     * to be thesame over time and for different bots.
50
     * Can't be used to download or reuse the file.
51
     *
52
     * @var string
53
     */
54
    protected $fileUniqueId;
55
56
    /**
57
     * Video width as defined by sender
58
     *
59
     * @var int
60
     */
61
    protected $width;
62
63
    /**
64
     * Video height as defined by sender
65
     *
66
     * @var int
67
     */
68
    protected $height;
69
70
    /**
71
     * Duration of the video in seconds as defined by sender
72
     *
73
     * @var int
74
     */
75
    protected $duration;
76
77
    /**
78
     * Video thumbnail
79
     *
80
     * @var PhotoSize
81
     */
82
    protected $thumb;
83
84
85
    /**
86
     * Optional. Mime type of a file as defined by sender
87
     *
88
     * @var string
89
     */
90
    protected $mimeType;
91
92
    /**
93
     * Optional. File size
94
     *
95
     * @var int
96
     */
97
    protected $fileSize;
98
99
    /**
100
     * @return int
101
     */
102 1
    public function getDuration()
103
    {
104 1
        return $this->duration;
105
    }
106
107
    /**
108
     * @param int $duration
109
     *
110
     * @throws InvalidArgumentException
111
     */
112 6
    public function setDuration($duration)
113
    {
114 6
        if (is_integer($duration)) {
115 5
            $this->duration = $duration;
116 5
        } else {
117 1
            throw new InvalidArgumentException();
118
        }
119 5
    }
120
121
    /**
122
     * @return string
123
     */
124 1
    public function getFileId()
125
    {
126 1
        return $this->fileId;
127
    }
128
129
    /**
130
     * @param string $fileId
131
     */
132 5
    public function setFileId($fileId)
133
    {
134 5
        $this->fileId = $fileId;
135 5
    }
136
137
    /**
138
     * @return string
139
     */
140
    public function getFileUniqueId()
141
    {
142
        return $this->fileUniqueId;
143
    }
144
145
    /**
146
     * @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...
147
     */
148
    public function setFileUniqueId($fileUniqueId)
149
    {
150
        $this->fileUniqueId = $fileUniqueId;
151
    }
152
153
    /**
154
     * @return int
155
     */
156 1
    public function getFileSize()
157
    {
158 1
        return $this->fileSize;
159
    }
160
161
    /**
162
     * @param int $fileSize
163
     *
164
     * @throws InvalidArgumentException
165
     */
166 6
    public function setFileSize($fileSize)
167
    {
168 6
        if (is_integer($fileSize)) {
169 5
            $this->fileSize = $fileSize;
170 5
        } else {
171 1
            throw new InvalidArgumentException();
172
        }
173 5
    }
174
175
    /**
176
     * @return int
177
     */
178 1
    public function getHeight()
179
    {
180 1
        return $this->height;
181
    }
182
183
    /**
184
     * @param int $height
185
     *
186
     * @throws InvalidArgumentException
187
     */
188 6
    public function setHeight($height)
189
    {
190 6
        if (is_integer($height)) {
191 5
            $this->height = $height;
192 5
        } else {
193 1
            throw new InvalidArgumentException();
194
        }
195 5
    }
196
197
    /**
198
     * @return string
199
     */
200 1
    public function getMimeType()
201
    {
202 1
        return $this->mimeType;
203
    }
204
205
    /**
206
     * @param string $mimeType
207
     */
208 5
    public function setMimeType($mimeType)
209
    {
210 5
        $this->mimeType = $mimeType;
211 5
    }
212
213
    /**
214
     * @return PhotoSize
215
     */
216 2
    public function getThumb()
217
    {
218 2
        return $this->thumb;
219
    }
220
221
    /**
222
     * @param PhotoSize $thumb
223
     */
224 5
    public function setThumb(PhotoSize $thumb)
225
    {
226 5
        $this->thumb = $thumb;
227 5
    }
228
229
    /**
230
     * @return int
231
     */
232 1
    public function getWidth()
233
    {
234 1
        return $this->width;
235
    }
236
237
    /**
238
     * @param int $width
239
     *
240
     * @throws InvalidArgumentException
241
     */
242 6
    public function setWidth($width)
243
    {
244 6
        if (is_integer($width)) {
245 5
            $this->width = $width;
246 5
        } else {
247 1
            throw new InvalidArgumentException();
248
        }
249 5
    }
250
}
251