Completed
Push — master ( e9eebf...b866da )
by Gusev
03:01
created

Video::setVideoDuration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace TelegramBot\Api\Types\Inline\QueryResult;
4
5
/**
6
 * Class InlineQueryResultVideo
7
 * Represents link to a page containing an embedded video player or a video file.
8
 *
9
 * @package TelegramBot\Api\Types\Inline
10
 */
11 View Code Duplication
class Video extends AbstractInlineQueryResult
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    /**
14
     * {@inheritdoc}
15
     *
16
     * @var array
17
     */
18
    static protected $requiredParams = ['type', 'id', 'video_url', 'mime_type', 'thumb_url'];
19
20
    /**
21
     * {@inheritdoc}
22
     *
23
     * @var array
24
     */
25
    static protected $map = [
26
        'type' => true,
27
        'id' => true,
28
        'video_url' => true,
29
        'mime_type' => true,
30
        'message_text' => true,
31
        'parse_mode' => true,
32
        'disable_web_page_preview' => true,
33
        'video_width' => true,
34
        'video_height' => true,
35
        'video_duration' => true,
36
        'thumb_url' => true,
37
        'title' => true,
38
        'description' => true,
39
    ];
40
41
    /**
42
     * {@inheritdoc}
43
     *
44
     * @var string
45
     */
46
    protected $type = 'video';
47
48
    /**
49
     * A valid URL for the embedded video player or video file
50
     *
51
     * @var string
52
     */
53
    protected $videoUrl;
54
55
    /**
56
     * Mime type of the content of video url, “text/html” or “video/mp4”
57
     *
58
     * @var string
59
     */
60
    protected $mimeType;
61
62
    /**
63
     * Optional. Video width
64
     *
65
     * @var int
66
     */
67
    protected $videoWidth;
68
69
    /**
70
     * Optional. Video height
71
     *
72
     * @var int
73
     */
74
    protected $videoHeight;
75
76
    /**
77
     * Optional. Video duration in seconds
78
     *
79
     * @var int
80
     */
81
    protected $videoDuration;
82
83
    /**
84
     * URL of the thumbnail (jpeg only) for the video
85
     *
86
     * @var string
87
     */
88
    protected $thumbUrl;
89
90
    /**
91
     * Optional. Short description of the result
92
     *
93
     * @var string
94
     */
95
    protected $description;
96
97
    /**
98
     * InlineQueryResultVideo constructor.
99
     *
100
     * @param string $id
101
     * @param string $videoUrl
102
     * @param string $thumbUrl
103
     * @param string $mimeType
104
     * @param string|null $messageText
105
     * @param string|null $parseMode
106
     * @param bool|null $disableWebPagePreview
107
     * @param int|null $videoWidth
108
     * @param int|null $videoHeight
109
     * @param int|null $videoDuration
110
     * @param string|null $title
111
     * @param string|null $description
112
     */
113
    public function __construct(
114
        $id,
115
        $videoUrl,
116
        $thumbUrl,
117
        $mimeType,
118
        $messageText = null,
119
        $parseMode = null,
120
        $disableWebPagePreview = null,
121
        $videoWidth = null,
122
        $videoHeight = null,
123
        $videoDuration = null,
124
        $title = null,
125
        $description = null
126
    ) {
127
        parent::__construct($id, $title, $messageText, $parseMode, $disableWebPagePreview);
0 ignored issues
show
Bug introduced by
It seems like $messageText defined by parameter $messageText on line 118 can also be of type string; however, TelegramBot\Api\Types\In...ryResult::__construct() does only seem to accept object<TelegramBot\Api\T...putMessageContent>|null, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
Bug introduced by
It seems like $parseMode defined by parameter $parseMode on line 119 can also be of type string; however, TelegramBot\Api\Types\In...ryResult::__construct() does only seem to accept object<TelegramBot\Api\T...ineKeyboardMarkup>|null, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
Unused Code introduced by
The call to AbstractInlineQueryResult::__construct() has too many arguments starting with $disableWebPagePreview.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
128
        
129
        $this->videoUrl = $videoUrl;
130
        $this->thumbUrl = $thumbUrl;
131
        $this->mimeType = $mimeType;
132
        $this->videoWidth = $videoWidth;
133
        $this->videoHeight = $videoHeight;
134
        $this->videoDuration = $videoDuration;
135
        $this->description = $description;
136
    }
137
138
139
    /**
140
     * @return string
141
     */
142
    public function getVideoUrl()
143
    {
144
        return $this->videoUrl;
145
    }
146
147
    /**
148
     * @param string $videoUrl
149
     */
150
    public function setVideoUrl($videoUrl)
151
    {
152
        $this->videoUrl = $videoUrl;
153
    }
154
155
    /**
156
     * @return string
157
     */
158
    public function getMimeType()
159
    {
160
        return $this->mimeType;
161
    }
162
163
    /**
164
     * @param string $mimeType
165
     */
166
    public function setMimeType($mimeType)
167
    {
168
        $this->mimeType = $mimeType;
169
    }
170
171
    /**
172
     * @return int
173
     */
174
    public function getVideoWidth()
175
    {
176
        return $this->videoWidth;
177
    }
178
179
    /**
180
     * @param int $videoWidth
181
     */
182
    public function setVideoWidth($videoWidth)
183
    {
184
        $this->videoWidth = $videoWidth;
185
    }
186
187
    /**
188
     * @return int
189
     */
190
    public function getVideoHeight()
191
    {
192
        return $this->videoHeight;
193
    }
194
195
    /**
196
     * @param int $videoHeight
197
     */
198
    public function setVideoHeight($videoHeight)
199
    {
200
        $this->videoHeight = $videoHeight;
201
    }
202
203
    /**
204
     * @return int
205
     */
206
    public function getVideoDuration()
207
    {
208
        return $this->videoDuration;
209
    }
210
211
    /**
212
     * @param int $videoDuration
213
     */
214
    public function setVideoDuration($videoDuration)
215
    {
216
        $this->videoDuration = $videoDuration;
217
    }
218
219
    /**
220
     * @return mixed
221
     */
222
    public function getThumbUrl()
223
    {
224
        return $this->thumbUrl;
225
    }
226
227
    /**
228
     * @param mixed $thumbUrl
229
     */
230
    public function setThumbUrl($thumbUrl)
231
    {
232
        $this->thumbUrl = $thumbUrl;
233
    }
234
235
    /**
236
     * @return string
237
     */
238
    public function getDescription()
239
    {
240
        return $this->description;
241
    }
242
243
    /**
244
     * @param string $description
245
     */
246
    public function setDescription($description)
247
    {
248
        $this->description = $description;
249
    }
250
}
251