Completed
Pull Request — master (#22)
by
unknown
02:32 queued 49s
created

CreateMeetingParameters::setLogo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
4
 *
5
 * Copyright (c) 2016 BigBlueButton Inc. and by respective authors (see below).
6
 *
7
 * This program is free software; you can redistribute it and/or modify it under the
8
 * terms of the GNU Lesser General Public License as published by the Free Software
9
 * Foundation; either version 3.0 of the License, or (at your option) any later
10
 * version.
11
 *
12
 * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
13
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14
 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public License along
17
 * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
18
 */
19
namespace BigBlueButton\Parameters;
20
21
/**
22
 * Class CreateMeetingParameters.
23
 */
24
class CreateMeetingParameters extends MetaParameters
25
{
26
    /**
27
     * @var string
28
     */
29
    private $meetingId;
30
31
    /**
32
     * @var string
33
     */
34
    private $meetingName;
35
36
    /**
37
     * @var string
38
     */
39
    private $attendeePassword;
40
41
    /**
42
     * @var string
43
     */
44
    private $moderatorPassword;
45
46
    /**
47
     * @var string
48
     */
49
    private $dialNumber;
50
51
    /**
52
     * @var int
53
     */
54
    private $voiceBridge;
55
56
    /**
57
     * @var string
58
     */
59
    private $webVoice;
60
61
    /**
62
     * @var string
63
     */
64
    private $logoutUrl;
65
66
    /**
67
     * @var int
68
     */
69
    private $maxParticipants;
70
71
    /**
72
     * @var bool
73
     */
74
    private $record;
75
76
    /**
77
     * @var bool
78
     */
79
    private $autoStartRecording;
80
81
    /**
82
     * @var bool
83
     */
84
    private $allowStartStopRecording;
85
86
    /**
87
     * @var int
88
     */
89
    private $duration;
90
91
    /**
92
     * @var string
93
     */
94
    private $welcomeMessage;
95
96
    /**
97
     * @var string
98
     */
99
    private $moderatorOnlyMessage;
100
101
    /**
102
     * @var string
103
     */
104
    private $logo;
105
106
    /**
107
     * @var string
108
     */
109
    private $copyright;
110
111
    /**
112
     * @var bool
113
     */
114
    private $muteOnStart;
115
116
    /**
117
     * @var array
118
     */
119
    private $presentations = [];
120
121
    /**
122
     * CreateMeetingParameters constructor.
123
     *
124
     * @param $meetingId
125
     * @param $meetingName
126
     */
127
    public function __construct($meetingId, $meetingName)
128
    {
129
        $this->meetingId   = $meetingId;
130
        $this->meetingName = $meetingName;
131
    }
132
133
    /**
134
     * @return string
135
     */
136
    public function getMeetingId()
137
    {
138
        return $this->meetingId;
139
    }
140
141
    /**
142
     * @param string $meetingId
143
     *
144
     * @return CreateMeetingParameters
145
     */
146
    public function setMeetingId($meetingId)
147
    {
148
        $this->meetingId = $meetingId;
149
150
        return $this;
151
    }
152
153
    /**
154
     * @return string
155
     */
156
    public function getMeetingName()
157
    {
158
        return $this->meetingName;
159
    }
160
161
    /**
162
     * @param string $meetingName
163
     *
164
     * @return CreateMeetingParameters
165
     */
166
    public function setMeetingName($meetingName)
167
    {
168
        $this->meetingName = $meetingName;
169
170
        return $this;
171
    }
172
173
    /**
174
     * @return string
175
     */
176
    public function getAttendeePassword()
177
    {
178
        return $this->attendeePassword;
179
    }
180
181
    /**
182
     * @param string $attendeePassword
183
     *
184
     * @return CreateMeetingParameters
185
     */
186
    public function setAttendeePassword($attendeePassword)
187
    {
188
        $this->attendeePassword = $attendeePassword;
189
190
        return $this;
191
    }
192
193
    /**
194
     * @return string
195
     */
196
    public function getModeratorPassword()
197
    {
198
        return $this->moderatorPassword;
199
    }
200
201
    /**
202
     * @param string $moderatorPassword
203
     *
204
     * @return CreateMeetingParameters
205
     */
206
    public function setModeratorPassword($moderatorPassword)
207
    {
208
        $this->moderatorPassword = $moderatorPassword;
209
210
        return $this;
211
    }
212
213
    /**
214
     * @return string
215
     */
216
    public function getDialNumber()
217
    {
218
        return $this->dialNumber;
219
    }
220
221
    /**
222
     * @param string $dialNumber
223
     *
224
     * @return CreateMeetingParameters
225
     */
226
    public function setDialNumber($dialNumber)
227
    {
228
        $this->dialNumber = $dialNumber;
229
230
        return $this;
231
    }
232
233
    /**
234
     * @return int
235
     */
236
    public function getVoiceBridge()
237
    {
238
        return $this->voiceBridge;
239
    }
240
241
    /**
242
     * @param int $voiceBridge
243
     *
244
     * @return CreateMeetingParameters
245
     */
246
    public function setVoiceBridge($voiceBridge)
247
    {
248
        $this->voiceBridge = $voiceBridge;
249
250
        return $this;
251
    }
252
253
    /**
254
     * @return string
255
     */
256
    public function getWebVoice()
257
    {
258
        return $this->webVoice;
259
    }
260
261
    /**
262
     * @param string $webVoice
263
     *
264
     * @return CreateMeetingParameters
265
     */
266
    public function setWebVoice($webVoice)
267
    {
268
        $this->webVoice = $webVoice;
269
270
        return $this;
271
    }
272
273
    /**
274
     * @return string
275
     */
276
    public function getLogoutUrl()
277
    {
278
        return $this->logoutUrl;
279
    }
280
281
    /**
282
     * @param string $logoutUrl
283
     *
284
     * @return CreateMeetingParameters
285
     */
286
    public function setLogoutUrl($logoutUrl)
287
    {
288
        $this->logoutUrl = $logoutUrl;
289
290
        return $this;
291
    }
292
293
    /**
294
     * @return int
295
     */
296
    public function getMaxParticipants()
297
    {
298
        return $this->maxParticipants;
299
    }
300
301
    /**
302
     * @param int $maxParticipants
303
     *
304
     * @return CreateMeetingParameters
305
     */
306
    public function setMaxParticipants($maxParticipants)
307
    {
308
        $this->maxParticipants = $maxParticipants;
309
310
        return $this;
311
    }
312
313
    /**
314
     * @return bool
315
     */
316
    public function isRecorded()
317
    {
318
        return $this->record;
319
    }
320
321
    /**
322
     * @param bool $record
323
     *
324
     * @return CreateMeetingParameters
325
     */
326
    public function setRecord($record)
327
    {
328
        $this->record = $record;
329
330
        return $this;
331
    }
332
333
    /**
334
     * @return bool
335
     */
336
    public function isAutoStartRecording()
337
    {
338
        return $this->autoStartRecording;
339
    }
340
341
    /**
342
     * @param bool $autoStartRecording
343
     *
344
     * @return CreateMeetingParameters
345
     */
346
    public function setAutoStartRecording($autoStartRecording)
347
    {
348
        $this->autoStartRecording = $autoStartRecording;
349
350
        return $this;
351
    }
352
353
    /**
354
     * @return bool
355
     */
356
    public function isAllowStartStopRecording()
357
    {
358
        return $this->allowStartStopRecording;
359
    }
360
361
    /**
362
     * @param bool $autoStartRecording
363
     *
364
     * @return CreateMeetingParameters
365
     */
366
    public function setAllowStartStopRecording($autoStartRecording)
367
    {
368
        $this->allowStartStopRecording = $autoStartRecording;
369
370
        return $this;
371
    }
372
373
    /**
374
     * @return int
375
     */
376
    public function getDuration()
377
    {
378
        return $this->duration;
379
    }
380
381
    /**
382
     * @param int $duration
383
     *
384
     * @return CreateMeetingParameters
385
     */
386
    public function setDuration($duration)
387
    {
388
        $this->duration = $duration;
389
390
        return $this;
391
    }
392
393
    /**
394
     * @return string
395
     */
396
    public function getWelcomeMessage()
397
    {
398
        return $this->welcomeMessage;
399
    }
400
401
    /**
402
     * @param string $welcomeMessage
403
     *
404
     * @return CreateMeetingParameters
405
     */
406
    public function setWelcomeMessage($welcomeMessage)
407
    {
408
        $this->welcomeMessage = $welcomeMessage;
409
410
        return $this;
411
    }
412
413
    /**
414
     * @return string
415
     */
416
    public function getModeratorOnlyMessage()
417
    {
418
        return $this->moderatorOnlyMessage;
419
    }
420
421
    /**
422
     * @param string $message
423
     *
424
     * @return CreateMeetingParameters
425
     */
426
    public function setModeratorOnlyMessage($message)
427
    {
428
        $this->moderatorOnlyMessage = $message;
429
430
        return $this;
431
    }
432
433
    /**
434
     * @return string
435
     */
436
    public function getLogo()
437
    {
438
        return $this->moderatorOnlyMessage;
439
    }
440
441
    /**
442
     * @param string $message
0 ignored issues
show
Bug introduced by
There is no parameter named $message. 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...
443
     *
444
     * @return CreateMeetingParameters
445
     */
446
    public function setLogo($url)
447
    {
448
        $this->logo = $url;
449
450
        return $this;
451
    }
452
453
    /**
454
     * @return string
455
     */
456
    public function getCopyright()
457
    {
458
        return $this->copyright;
459
    }
460
461
    /**
462
     * @param string $message
0 ignored issues
show
Bug introduced by
There is no parameter named $message. 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...
463
     *
464
     * @return CreateMeetingParameters
465
     */
466
    public function setCopyright($string)
467
    {
468
        $this->copyright = $string;
469
470
        return $this;
471
    }
472
473
    /**
474
     * @return bool
475
     */
476
    public function isMuteOnStart()
477
    {
478
        return $this->muteOnStart;
479
    }
480
481
    /**
482
     * @param bool $muteOnStart
483
     *
484
     * @return CreateMeetingParameters
485
     */
486
    public function setMuteOnStart($muteOnStart)
487
    {
488
        $this->muteOnStart = $muteOnStart;
489
490
        return $this;
491
    }
492
493
    /**
494
     * @return array
495
     */
496
    public function getPresentations()
497
    {
498
        return $this->presentations;
499
    }
500
501
    /**
502
     * @param $nameOrUrl
503
     * @param null $content
504
     *
505
     * @return CreateMeetingParameters
506
     */
507
    public function addPresentation($nameOrUrl, $content = null)
508
    {
509
        $this->presentations[$nameOrUrl] = !$content ?: base64_encode($content);
510
511
        return $this;
512
    }
513
514
    public function getPresentationsAsXML()
515
    {
516
        $result = '';
517
518
        if (!empty($this->presentations)) {
519
            $xml    = new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><modules/>');
520
            $module = $xml->addChild('module');
521
            $module->addAttribute('name', 'presentation');
522
523
            foreach ($this->presentations as $nameOrUrl => $content) {
524
                if ($this->presentations[$nameOrUrl] === true) {
525
                    $module->addChild('document')->addAttribute('url', urlencode($nameOrUrl));
526
                } else {
527
                    $document = $module->addChild('document');
528
                    $document->addAttribute('name', $nameOrUrl);
529
                    $document[0] = $content;
530
                }
531
            }
532
            $result = $xml->asXML();
533
        }
534
535
        return $result;
536
    }
537
538
    /**
539
     * @return string
540
     */
541
    public function getHTTPQuery()
542
    {
543
        $queries = [
544
            'name'                    => $this->meetingName,
545
            'meetingID'               => $this->meetingId,
546
            'attendeePW'              => $this->attendeePassword,
547
            'moderatorPW'             => $this->moderatorPassword,
548
            'dialNumber'              => $this->dialNumber,
549
            'voiceBridge'             => $this->voiceBridge,
550
            'webVoice'                => $this->webVoice,
551
            'logoutURL'               => $this->logoutUrl,
552
            'record'                  => $this->record ? 'true' : 'false',
553
            'duration'                => $this->duration,
554
            'maxParticipants'         => $this->maxParticipants,
555
            'autoStartRecording'      => $this->autoStartRecording ? 'true' : 'false',
556
            'allowStartStopRecording' => $this->allowStartStopRecording ? 'true' : 'false',
557
            'welcome'                 => trim($this->welcomeMessage),
558
            'moderatorOnlyMessage'    => trim($this->moderatorOnlyMessage),
559
            'logo'                    => $this->logo,
560
            'copyright'               => $this->copyright,
561
            'muteOnStart'             => $this->muteOnStart ? 'false' : 'true'
562
        ];
563
564
        $this->buildMeta($queries);
565
566
        return $this->buildHTTPQuery($queries);
567
    }
568
}
569