Passed
Pull Request — master (#194)
by
unknown
01:44
created

JoinMeetingParameters::getCreationTime()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * BigBlueButton open source conferencing system - https://www.bigbluebutton.org/.
5
 *
6
 * Copyright (c) 2016-2023 BigBlueButton Inc. and by respective authors (see below).
7
 *
8
 * This program is free software; you can redistribute it and/or modify it under the
9
 * terms of the GNU Lesser General Public License as published by the Free Software
10
 * Foundation; either version 3.0 of the License, or (at your option) any later
11
 * version.
12
 *
13
 * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
14
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15
 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public License along
18
 * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
namespace BigBlueButton\Parameters;
22
23
use BigBlueButton\Enum\Role;
24
25
/**
26
 * Class JoinMeetingParametersTest.
27
 */
28
class JoinMeetingParameters extends UserDataParameters
29
{
30
    /**
31
     * @var string
32
     */
33
    private $meetingId;
34
35
    /**
36
     * @var string
37
     */
38
    private $username;
39
40
    /**
41
     * @var string
42
     *
43
     * @deprecated
44
     */
45
    private $password;
46
47
    /**
48
     * @var string
49
     */
50
    private $userId;
51
52
    /**
53
     * @var string
54
     */
55
    private $webVoiceConf;
56
57
    /**
58
     * @var string
59
     */
60
    private $creationTime;
61
62
    /**
63
     * @var string
64
     */
65
    private $avatarURL;
66
67
    /**
68
     * @var bool
69
     */
70
    private $redirect;
71
72
    /**
73
     * @var string
74
     */
75
    private $clientURL;
76
77
    /**
78
     * @var array
79
     */
80
    private $customParameters;
81
82
    /**
83
     * @var string
84
     */
85
    private $role;
86
87
    /**
88
     * @var bool
89
     */
90
    private $excludeFromDashboard;
91
    
92
    /**
93
     * @var string
94
     */
95
    private $configToken;
96
    
97
    /**
98
     * @var bool
99
     */
100
    private $guest;
101
    
102
    /**
103
     * @var string
104
     */
105
    private $defaultLayout;
106
107
    /**
108
     * JoinMeetingParametersTest constructor.
109
     *
110
     * @param $passwordOrRole
111
     * @param mixed $passworOrRole
112
     * @param mixed $meetingId
113
     * @param mixed $username
114
     */
115
    public function __construct($meetingId, $username, $passworOrRole)
116
    {
117
        $this->meetingId = $meetingId;
118
        $this->username  = $username;
119
        if (Role::MODERATOR === $passworOrRole || Role::VIEWER === $passworOrRole) {
120
            $this->role = $passworOrRole;
121
        } else {
122
            $this->password = $passworOrRole;
0 ignored issues
show
Deprecated Code introduced by
The property BigBlueButton\Parameters...ngParameters::$password has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

122
            /** @scrutinizer ignore-deprecated */ $this->password = $passworOrRole;
Loading history...
123
        }
124
        $this->customParameters = [];
125
    }
126
127
    /**
128
     * @return string
129
     */
130
    public function getMeetingId()
131
    {
132
        return $this->meetingId;
133
    }
134
135
    /**
136
     * @param string $meetingId
137
     *
138
     * @return JoinMeetingParameters
139
     */
140
    public function setMeetingId($meetingId)
141
    {
142
        $this->meetingId = $meetingId;
143
144
        return $this;
145
    }
146
147
    /**
148
     * @return string
149
     */
150
    public function getUsername()
151
    {
152
        return $this->username;
153
    }
154
155
    /**
156
     * @param string $username
157
     *
158
     * @return JoinMeetingParameters
159
     */
160
    public function setUsername($username)
161
    {
162
        $this->username = $username;
163
164
        return $this;
165
    }
166
167
    /**
168
     * @deprecated
169
     *
170
     * @return string
171
     */
172
    public function getPassword()
173
    {
174
        return $this->password;
0 ignored issues
show
Deprecated Code introduced by
The property BigBlueButton\Parameters...ngParameters::$password has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

174
        return /** @scrutinizer ignore-deprecated */ $this->password;
Loading history...
175
    }
176
177
    /**
178
     * @param string $password
179
     *
180
     * @deprecated
181
     *
182
     * @return JoinMeetingParameters
183
     */
184
    public function setPassword($password)
185
    {
186
        $this->password = $password;
0 ignored issues
show
Deprecated Code introduced by
The property BigBlueButton\Parameters...ngParameters::$password has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

186
        /** @scrutinizer ignore-deprecated */ $this->password = $password;
Loading history...
187
188
        return $this;
189
    }
190
191
    /**
192
     * @return string
193
     */
194
    public function getUserId()
195
    {
196
        return $this->userId;
197
    }
198
199
    /**
200
     * @param string $userId
201
     *
202
     * @return JoinMeetingParameters
203
     */
204
    public function setUserId($userId)
205
    {
206
        $this->userId = $userId;
207
208
        return $this;
209
    }
210
211
    /**
212
     * @return string
213
     */
214
    public function getWebVoiceConf()
215
    {
216
        return $this->webVoiceConf;
217
    }
218
219
    /**
220
     * @param string $webVoiceConf
221
     *
222
     * @return JoinMeetingParameters
223
     */
224
    public function setWebVoiceConf($webVoiceConf)
225
    {
226
        $this->webVoiceConf = $webVoiceConf;
227
228
        return $this;
229
    }
230
231
    /**
232
     * @return string
233
     */
234
    public function getCreationTime()
235
    {
236
        return $this->creationTime;
237
    }
238
239
    /**
240
     * @param int $creationTime
241
     *
242
     * @return JoinMeetingParameters
243
     */
244
    public function setCreationTime($creationTime)
245
    {
246
        $this->creationTime = $creationTime;
247
248
        return $this;
249
    }
250
251
    /**
252
     * @return string
253
     */
254
    public function getAvatarURL()
255
    {
256
        return $this->avatarURL;
257
    }
258
259
    /**
260
     * @param string $avatarURL
261
     *
262
     * @return JoinMeetingParameters
263
     */
264
    public function setAvatarURL($avatarURL)
265
    {
266
        $this->avatarURL = $avatarURL;
267
268
        return $this;
269
    }
270
271
    /**
272
     * @return null|bool
273
     */
274
    public function isRedirect()
275
    {
276
        return $this->redirect;
277
    }
278
279
    /**
280
     * @param bool $redirect
281
     *
282
     * @return JoinMeetingParameters
283
     */
284
    public function setRedirect($redirect)
285
    {
286
        $this->redirect = $redirect;
287
288
        return $this;
289
    }
290
291
    /**
292
     * @return mixed
293
     */
294
    public function getClientURL()
295
    {
296
        return $this->clientURL;
297
    }
298
299
    /**
300
     * @param mixed $clientURL
301
     *
302
     * @return JoinMeetingParameters
303
     */
304
    public function setClientURL($clientURL)
305
    {
306
        $this->clientURL = $clientURL;
307
308
        return $this;
309
    }
310
311
    /**
312
     * @return string
313
     */
314
    public function getRole()
315
    {
316
        return $this->role;
317
    }
318
319
    /**
320
     * @param string $role
321
     */
322
    public function setRole($role): JoinMeetingParameters
323
    {
324
        $this->role = $role;
325
326
        return $this;
327
    }
328
329
    /**
330
     * @return bool
331
     */
332
    public function isExcludeFromDashboard()
333
    {
334
        return $this->excludeFromDashboard;
335
    }
336
337
    /**
338
     * @param bool $excludeFromDashboard
339
     */
340
    public function setExcludeFromDashboard($excludeFromDashboard): JoinMeetingParameters
341
    {
342
        $this->excludeFromDashboard = $excludeFromDashboard;
343
344
        return $this;
345
    }
346
    
347
    /**
348
     * @return string
349
     */
350
    public function getConfigToken()
351
    {
352
        return $this->configToken;
353
    }
354
355
    /**
356
     * @param string $configToken
357
     *
358
     * @return JoinMeetingParameters
359
     */
360
    public function setConfigToken($configToken)
361
    {
362
        $this->configToken = $configToken;
363
364
        return $this;
365
    }
366
    
367
    /**
368
     * @return bool
369
     */
370
    public function isGuest()
371
    {
372
        return $this->guest;
373
    }
374
375
    /**
376
     * @param bool $guest
377
     *
378
     * @return JoinMeetingParameters
379
     */
380
    public function setGuest($guest)
381
    {
382
        $this->guest = $guest;
383
384
        return $this;
385
    }
386
    
387
    /**
388
     * @return string
389
     */
390
    public function getDefaultLayout()
391
    {
392
        return $this->defaultLayout;
393
    }
394
395
    /**
396
     * @param bool $defaultLayout
397
     *
398
     * @return JoinMeetingParameters
399
     */
400
    public function setDefaultLayout($defaultLayout)
401
    {
402
        $this->defaultLayout = $defaultLayout;
0 ignored issues
show
Documentation Bug introduced by
The property $defaultLayout was declared of type string, but $defaultLayout is of type boolean. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
403
404
        return $this;
405
    }
406
407
    /**
408
     * @param string $paramName
409
     * @param string $paramValue
410
     *
411
     * @return JoinMeetingParameters
412
     */
413
    public function setCustomParameter($paramName, $paramValue)
414
    {
415
        $this->customParameters[$paramName] = $paramValue;
416
417
        return $this;
418
    }
419
420
    /**
421
     * @return string
422
     */
423
    public function getHTTPQuery()
424
    {
425
        $queries = [
426
            'meetingID'            => $this->meetingId,
427
            'fullName'             => $this->username,
428
            'password'             => $this->password,
0 ignored issues
show
Deprecated Code introduced by
The property BigBlueButton\Parameters...ngParameters::$password has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

428
            'password'             => /** @scrutinizer ignore-deprecated */ $this->password,
Loading history...
429
            'userID'               => $this->userId,
430
            'webVoiceConf'         => $this->webVoiceConf,
431
            'createTime'           => $this->creationTime,
432
            'role'                 => $this->role,
433
            'excludeFromDashboard' => $this->excludeFromDashboard ? 'true' : 'false',
434
            'avatarURL'            => $this->avatarURL,
435
            'redirect'             => $this->redirect ? 'true' : 'false',
436
            'clientURL'            => $this->clientURL,
437
            'configToken'           => $this->configToken,
438
            'guest'                 => $this->guest ? 'true' : 'false',
439
            'defaultLayout'         => $this->defaultLayout,
440
        ];
441
442
        foreach ($this->customParameters as $key => $value) {
443
            $queries[$key] = $value;
444
        }
445
446
        $this->buildUserData($queries);
447
448
        return $this->buildHTTPQuery($queries);
449
    }
450
}
451