Completed
Pull Request — master (#44)
by
unknown
01:40
created

CreateMeetingParameters::setDialNumber()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * BigBlueButton open source conferencing system - https://www.bigbluebutton.org/.
4
 *
5
 * Copyright (c) 2016-2018 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 bool
103
     */
104
    private $webcamsOnlyForModerator;
105
106
    /**
107
     * @var string
108
     */
109
    private $logo;
110
111
    /**
112
     * @var string
113
     */
114
    private $copyright;
115
116
    /**
117
     * @var bool
118
     */
119
    private $muteOnStart;
120
121
    /**
122
     * @var bool
123
     */
124
    private $lockSettingsDisableCam;
125
126
    /**
127
     * @var bool
128
     */
129
    private $lockSettingsDisableMic;
130
131
    /**
132
     * @var bool
133
     */
134
    private $lockSettingsDisablePrivateChat;
135
136
    /**
137
     * @var bool
138
     */
139
    private $lockSettingsDisablePublicChat;
140
141
    /**
142
     * @var bool
143
     */
144
    private $lockSettingsDisableNote;
145
146
    /**
147
     * @var bool
148
     */
149
    private $lockSettingsHideUserList;
150
151
    /**
152
     * @var bool
153
     */
154
    private $lockSettingsLockedLayout;
155
156
    /**
157
     * @var bool
158
     */
159
    private $lockSettingsLockOnJoin = true;
160
161
    /**
162
     * @var bool
163
     */
164
    private $lockSettingsLockOnJoinConfigurable;
165
166
    /**
167
     * @var array
168
     */
169
    private $presentations = [];
170
171
    /**
172
     * @var boolean
173
     */
174
    private $isBreakout;
175
176
    /**
177
     * @var string
178
     */
179
    private $parentMeetingId;
180
181
    /**
182
     * @var int
183
     */
184
    private $sequence;
185
186
    /**
187
     * @var boolean
188
     */
189
    private $freeJoin;
190
191
    /**
192
     * CreateMeetingParameters constructor.
193
     *
194
     * @param $meetingId
195
     * @param $meetingName
196
     */
197
    public function __construct($meetingId, $meetingName)
198
    {
199
        $this->meetingId   = $meetingId;
200
        $this->meetingName = $meetingName;
201
    }
202
203
    /**
204
     * @return string
205
     */
206
    public function getMeetingId()
207
    {
208
        return $this->meetingId;
209
    }
210
211
    /**
212
     * @param string $meetingId
213
     *
214
     * @return CreateMeetingParameters
215
     */
216
    public function setMeetingId($meetingId)
217
    {
218
        $this->meetingId = $meetingId;
219
220
        return $this;
221
    }
222
223
    /**
224
     * @return string
225
     */
226
    public function getMeetingName()
227
    {
228
        return $this->meetingName;
229
    }
230
231
    /**
232
     * @param string $meetingName
233
     *
234
     * @return CreateMeetingParameters
235
     */
236
    public function setMeetingName($meetingName)
237
    {
238
        $this->meetingName = $meetingName;
239
240
        return $this;
241
    }
242
243
    /**
244
     * @return string
245
     */
246
    public function getAttendeePassword()
247
    {
248
        return $this->attendeePassword;
249
    }
250
251
    /**
252
     * @param string $attendeePassword
253
     *
254
     * @return CreateMeetingParameters
255
     */
256
    public function setAttendeePassword($attendeePassword)
257
    {
258
        $this->attendeePassword = $attendeePassword;
259
260
        return $this;
261
    }
262
263
    /**
264
     * @return string
265
     */
266
    public function getModeratorPassword()
267
    {
268
        return $this->moderatorPassword;
269
    }
270
271
    /**
272
     * @param string $moderatorPassword
273
     *
274
     * @return CreateMeetingParameters
275
     */
276
    public function setModeratorPassword($moderatorPassword)
277
    {
278
        $this->moderatorPassword = $moderatorPassword;
279
280
        return $this;
281
    }
282
283
    /**
284
     * @return string
285
     */
286
    public function getDialNumber()
287
    {
288
        return $this->dialNumber;
289
    }
290
291
    /**
292
     * @param string $dialNumber
293
     *
294
     * @return CreateMeetingParameters
295
     */
296
    public function setDialNumber($dialNumber)
297
    {
298
        $this->dialNumber = $dialNumber;
299
300
        return $this;
301
    }
302
303
    /**
304
     * @return int
305
     */
306
    public function getVoiceBridge()
307
    {
308
        return $this->voiceBridge;
309
    }
310
311
    /**
312
     * @param int $voiceBridge
313
     *
314
     * @return CreateMeetingParameters
315
     */
316
    public function setVoiceBridge($voiceBridge)
317
    {
318
        $this->voiceBridge = $voiceBridge;
319
320
        return $this;
321
    }
322
323
    /**
324
     * @return string
325
     */
326
    public function getWebVoice()
327
    {
328
        return $this->webVoice;
329
    }
330
331
    /**
332
     * @param string $webVoice
333
     *
334
     * @return CreateMeetingParameters
335
     */
336
    public function setWebVoice($webVoice)
337
    {
338
        $this->webVoice = $webVoice;
339
340
        return $this;
341
    }
342
343
    /**
344
     * @return string
345
     */
346
    public function getLogoutUrl()
347
    {
348
        return $this->logoutUrl;
349
    }
350
351
    /**
352
     * @param string $logoutUrl
353
     *
354
     * @return CreateMeetingParameters
355
     */
356
    public function setLogoutUrl($logoutUrl)
357
    {
358
        $this->logoutUrl = $logoutUrl;
359
360
        return $this;
361
    }
362
363
    /**
364
     * @return int
365
     */
366
    public function getMaxParticipants()
367
    {
368
        return $this->maxParticipants;
369
    }
370
371
    /**
372
     * @param int $maxParticipants
373
     *
374
     * @return CreateMeetingParameters
375
     */
376
    public function setMaxParticipants($maxParticipants)
377
    {
378
        $this->maxParticipants = $maxParticipants;
379
380
        return $this;
381
    }
382
383
    /**
384
     * @return bool
385
     */
386
    public function isRecorded()
387
    {
388
        return $this->record;
389
    }
390
391
    /**
392
     * @param bool $record
393
     *
394
     * @return CreateMeetingParameters
395
     */
396
    public function setRecord($record)
397
    {
398
        $this->record = $record;
399
400
        return $this;
401
    }
402
403
    /**
404
     * @return bool
405
     */
406
    public function isAutoStartRecording()
407
    {
408
        return $this->autoStartRecording;
409
    }
410
411
    /**
412
     * @param bool $autoStartRecording
413
     *
414
     * @return CreateMeetingParameters
415
     */
416
    public function setAutoStartRecording($autoStartRecording)
417
    {
418
        $this->autoStartRecording = $autoStartRecording;
419
420
        return $this;
421
    }
422
423
    /**
424
     * @return bool
425
     */
426
    public function isAllowStartStopRecording()
427
    {
428
        return $this->allowStartStopRecording;
429
    }
430
431
    /**
432
     * @param bool $allowStartStopRecording
433
     *
434
     * @return CreateMeetingParameters
435
     */
436
    public function setAllowStartStopRecording($allowStartStopRecording)
437
    {
438
        $this->allowStartStopRecording = $allowStartStopRecording;
439
440
        return $this;
441
    }
442
443
    /**
444
     * @return int
445
     */
446
    public function getDuration()
447
    {
448
        return $this->duration;
449
    }
450
451
    /**
452
     * @param int $duration
453
     *
454
     * @return CreateMeetingParameters
455
     */
456
    public function setDuration($duration)
457
    {
458
        $this->duration = $duration;
459
460
        return $this;
461
    }
462
463
    /**
464
     * @return string
465
     */
466
    public function getWelcomeMessage()
467
    {
468
        return $this->welcomeMessage;
469
    }
470
471
    /**
472
     * @param string $welcomeMessage
473
     *
474
     * @return CreateMeetingParameters
475
     */
476
    public function setWelcomeMessage($welcomeMessage)
477
    {
478
        $this->welcomeMessage = $welcomeMessage;
479
480
        return $this;
481
    }
482
483
    /**
484
     * @return string
485
     */
486
    public function getModeratorOnlyMessage()
487
    {
488
        return $this->moderatorOnlyMessage;
489
    }
490
491
    /**
492
     * @param string $message
493
     *
494
     * @return CreateMeetingParameters
495
     */
496
    public function setModeratorOnlyMessage($message)
497
    {
498
        $this->moderatorOnlyMessage = $message;
499
500
        return $this;
501
    }
502
503
    /**
504
     * @return bool
505
     */
506
    public function isWebcamsOnlyForModerator()
507
    {
508
        return $this->webcamsOnlyForModerator;
509
    }
510
511
    /**
512
     * @param  bool                    $webcamsOnlyForModerator
513
     * @return CreateMeetingParameters
514
     */
515
    public function setWebcamsOnlyForModerator($webcamsOnlyForModerator)
516
    {
517
        $this->webcamsOnlyForModerator = $webcamsOnlyForModerator;
518
519
        return $this;
520
    }
521
522
    /**
523
     * @return string
524
     */
525
    public function getLogo()
526
    {
527
        return $this->logo;
528
    }
529
530
    /**
531
     * @param  string                  $logo
532
     * @return CreateMeetingParameters
533
     */
534
    public function setLogo($logo)
535
    {
536
        $this->logo = $logo;
537
538
        return $this;
539
    }
540
541
    /**
542
     * @return string
543
     */
544
    public function getCopyright()
545
    {
546
        return $this->copyright;
547
    }
548
549
    /**
550
     * @param  string                  $copyright
551
     * @return CreateMeetingParameters
552
     */
553
    public function setCopyright($copyright)
554
    {
555
        $this->copyright = $copyright;
556
557
        return $this;
558
    }
559
560
    /**
561
     * @return bool
562
     */
563
    public function isMuteOnStart()
564
    {
565
        return $this->muteOnStart;
566
    }
567
568
    /**
569
     * @param  bool                    $muteOnStart
570
     * @return CreateMeetingParameters
571
     */
572
    public function setMuteOnStart($muteOnStart)
573
    {
574
        $this->muteOnStart = $muteOnStart;
575
576
        return $this;
577
    }
578
579
    /**
580
     * @return bool
581
     */
582
    public function isLockSettingsDisableCam()
583
    {
584
        return $this->lockSettingsDisableCam;
585
    }
586
587
    /**
588
     * @param  bool                    $lockSettingsDisableCam
589
     * @return CreateMeetingParameters
590
     */
591
    public function setLockSettingsDisableCam($lockSettingsDisableCam)
592
    {
593
        $this->lockSettingsDisableCam = $lockSettingsDisableCam;
594
595
        return $this;
596
    }
597
598
    /**
599
     * @return bool
600
     */
601
    public function isLockSettingsDisableMic()
602
    {
603
        return $this->lockSettingsDisableMic;
604
    }
605
606
    /**
607
     * @param  bool                    $lockSettingsDisableMic
608
     * @return CreateMeetingParameters
609
     */
610
    public function setLockSettingsDisableMic($lockSettingsDisableMic)
611
    {
612
        $this->lockSettingsDisableMic = $lockSettingsDisableMic;
613
614
        return $this;
615
    }
616
617
    /**
618
     * @return bool
619
     */
620
    public function isLockSettingsDisablePrivateChat()
621
    {
622
        return $this->lockSettingsDisablePrivateChat;
623
    }
624
625
    /**
626
     * @param  bool                    $lockSettingsDisablePrivateChat
627
     * @return CreateMeetingParameters
628
     */
629
    public function setLockSettingsDisablePrivateChat($lockSettingsDisablePrivateChat)
630
    {
631
        $this->lockSettingsDisablePrivateChat = $lockSettingsDisablePrivateChat;
632
633
        return $this;
634
    }
635
636
    /**
637
     * @return bool
638
     */
639
    public function isLockSettingsDisablePublicChat()
640
    {
641
        return $this->lockSettingsDisablePublicChat;
642
    }
643
644
    /**
645
     * @param  bool                    $lockSettingsDisablePublicChat
646
     * @return CreateMeetingParameters
647
     */
648
    public function setLockSettingsDisablePublicChat($lockSettingsDisablePublicChat)
649
    {
650
        $this->lockSettingsDisablePublicChat = $lockSettingsDisablePublicChat;
651
652
        return $this;
653
    }
654
655
    /**
656
     * @return bool
657
     */
658
    public function isLockSettingsDisableNote()
659
    {
660
        return $this->lockSettingsDisableNote;
661
    }
662
663
    /**
664
     * @param  bool                    $lockSettingsDisableNote
665
     * @return CreateMeetingParameters
666
     */
667
    public function setLockSettingsDisableNote($lockSettingsDisableNote)
668
    {
669
        $this->lockSettingsDisableNote = $lockSettingsDisableNote;
670
671
        return $this;
672
    }
673
674
    /**
675
     * @return bool
676
     */
677
    public function isLockSettingsHideUserList()
678
    {
679
        return $this->lockSettingsHideUserList;
680
    }
681
682
    /**
683
     * @param  bool                    $lockSettingsHideUserList
684
     * @return CreateMeetingParameters
685
     */
686
    public function setLockSettingsHideUserList($lockSettingsHideUserList)
687
    {
688
        $this->lockSettingsHideUserList = $lockSettingsHideUserList;
689
690
        return $this;
691
    }
692
693
    /**
694
     * @return bool
695
     */
696
    public function isLockSettingsLockedLayout()
697
    {
698
        return $this->lockSettingsLockedLayout;
699
    }
700
701
    /**
702
     * @param  bool                    $lockSettingsLockedLayout
703
     * @return CreateMeetingParameters
704
     */
705
    public function setLockSettingsLockedLayout($lockSettingsLockedLayout)
706
    {
707
        $this->lockSettingsLockedLayout = $lockSettingsLockedLayout;
708
709
        return $this;
710
    }
711
712
    /**
713
     * @return bool
714
     */
715
    public function isLockSettingsLockOnJoin()
716
    {
717
        return $this->lockSettingsLockOnJoin;
718
    }
719
720
    /**
721
     * @param  bool                    $lockOnJoin
722
     * @return CreateMeetingParameters
723
     */
724
    public function setLockSettingsLockOnJoin($lockOnJoin)
725
    {
726
        $this->lockSettingsLockOnJoin = $lockOnJoin;
727
728
        return $this;
729
    }
730
731
    /**
732
     * @return bool
733
     */
734
    public function isLockSettingsLockOnJoinConfigurable()
735
    {
736
        return $this->lockSettingsLockOnJoinConfigurable;
737
    }
738
739
    /**
740
     * @param  bool                    $lockOnJoinConfigurable
741
     * @return CreateMeetingParameters
742
     */
743
    public function setLockSettingsLockOnJoinConfigurable($lockOnJoinConfigurable)
744
    {
745
        $this->lockSettingsLockOnJoinConfigurable = $lockOnJoinConfigurable;
746
747
        return $this;
748
    }
749
750
    /**
751
     * @param $endCallbackUrl
752
     * @return CreateMeetingParameters
753
     */
754
    public function setEndCallbackUrl($endCallbackUrl)
755
    {
756
        $this->addMeta('endCallbackUrl', $endCallbackUrl);
757
758
        return $this;
759
    }
760
761
    /**
762
     * @return bool
763
     */
764
    public function isBreakout()
765
    {
766
        return $this->isBreakout;
767
    }
768
769
    /**
770
     * @param  bool                    $isBreakout
771
     * @return CreateMeetingParameters
772
     */
773
    public function setBreakout($isBreakout)
774
    {
775
        $this->isBreakout = $isBreakout;
776
777
        return $this;
778
    }
779
780
    /**
781
     * @return string
782
     */
783
    public function getParentMeetingId()
784
    {
785
        return $this->parentMeetingId;
786
    }
787
788
    /**
789
     * @param  string                  $parentMeetingId
790
     * @return CreateMeetingParameters
791
     */
792
    public function setParentMeetingId($parentMeetingId)
793
    {
794
        $this->parentMeetingId = $parentMeetingId;
795
796
        return $this;
797
    }
798
799
    /**
800
     * @return int
801
     */
802
    public function getSequence()
803
    {
804
        return $this->sequence;
805
    }
806
807
    /**
808
     * @param  int                     $sequence
809
     * @return CreateMeetingParameters
810
     */
811
    public function setSequence($sequence)
812
    {
813
        $this->sequence = $sequence;
814
815
        return $this;
816
    }
817
818
    /**
819
     * @return bool
820
     */
821
    public function isFreeJoin()
822
    {
823
        return $this->freeJoin;
824
    }
825
826
    /**
827
     * @param  bool                    $freeJoin
828
     * @return CreateMeetingParameters
829
     */
830
    public function setFreeJoin($freeJoin)
831
    {
832
        $this->freeJoin = $freeJoin;
833
834
        return $this;
835
    }
836
837
    /**
838
     * @return array
839
     */
840
    public function getPresentations()
841
    {
842
        return $this->presentations;
843
    }
844
845
    /**
846
     * @param $nameOrUrl
847
     * @param null $content
848
     * @param null $filename
849
     *
850
     * @return CreateMeetingParameters
851
     */
852
    public function addPresentation($nameOrUrl, $content = null, $filename = null)
853
    {
854
        if (!$filename) {
855
            $this->presentations[$nameOrUrl] = !$content ?: base64_encode($content);
856
        } else {
857
            $this->presentations[$nameOrUrl] = $filename;
858
        }
859
860
        return $this;
861
    }
862
863
    /**
864
     * @return mixed
865
     */
866
    public function getPresentationsAsXML()
867
    {
868
        $result = '';
869
870
        if (!empty($this->presentations)) {
871
            $xml    = new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><modules/>');
872
            $module = $xml->addChild('module');
873
            $module->addAttribute('name', 'presentation');
874
875
            foreach ($this->presentations as $nameOrUrl => $content) {
876
                if (strpos($nameOrUrl, 'http') === 0) {
877
                    $presentation = $module->addChild('document');
878
                    $presentation->addAttribute('url', $nameOrUrl);
879
                    if (is_string($content)) {
880
                        $presentation->addAttribute('filename', $content);
881
                    }
882
                } else {
883
                    $document = $module->addChild('document');
884
                    $document->addAttribute('name', $nameOrUrl);
885
                    $document[0] = $content;
886
                }
887
            }
888
            $result = $xml->asXML();
889
        }
890
891
        return $result;
892
    }
893
894
    /**
895
     * @return string
896
     */
897
    public function getHTTPQuery()
898
    {
899
        $queries = [
900
            'name'                           => $this->meetingName,
901
            'meetingID'                      => $this->meetingId,
902
            'attendeePW'                     => $this->attendeePassword,
903
            'moderatorPW'                    => $this->moderatorPassword,
904
            'dialNumber'                     => $this->dialNumber,
905
            'voiceBridge'                    => $this->voiceBridge,
906
            'webVoice'                       => $this->webVoice,
907
            'logoutURL'                      => $this->logoutUrl,
908
            'record'                         => $this->record ? 'true' : 'false',
909
            'duration'                       => $this->duration,
910
            'maxParticipants'                => $this->maxParticipants,
911
            'autoStartRecording'             => $this->autoStartRecording ? 'true' : 'false',
912
            'allowStartStopRecording'        => $this->allowStartStopRecording ? 'true' : 'false',
913
            'welcome'                        => trim($this->welcomeMessage),
914
            'moderatorOnlyMessage'           => trim($this->moderatorOnlyMessage),
915
            'webcamsOnlyForModerator'        => $this->webcamsOnlyForModerator ? 'true' : 'false',
916
            'logo'                           => $this->logo,
917
            'copyright'                      => $this->copyright,
918
            'muteOnStart'                    => $this->muteOnStart,
919
            'lockSettingsDisableCam'         => $this->isLockSettingsDisableCam() ? 'true' : 'false',
920
            'lockSettingsDisableMic'         => $this->isLockSettingsDisableMic() ? 'true' : 'false',
921
            'lockSettingsDisablePrivateChat' => $this->isLockSettingsDisablePrivateChat() ? 'true' : 'false',
922
            'lockSettingsDisablePublicChat'  => $this->isLockSettingsDisablePublicChat() ? 'true' : 'false',
923
            'lockSettingsDisableNote'        => $this->isLockSettingsDisableNote() ? 'true' : 'false',
924
            'lockSettingsLockedLayout'       => $this->isLockSettingsLockedLayout() ? 'true' : 'false',
925
            'lockSettingsLockOnJoin'         => $this->isLockSettingsLockOnJoin() ? 'true' : 'false',
926
        ];
927
928
        // Add breakout rooms parameters only if the meeting is a breakout room
929
        if ($this->isBreakout()) {
930
            $queries = array_merge($queries, [
931
                'isBreakout'      => $this->isBreakout ? 'true' : 'false',
932
                'parentMeetingID' => $this->parentMeetingId,
933
                'sequence'        => $this->sequence,
934
                'freeJoin'        => $this->freeJoin ? 'true' : 'false'
935
            ]);
936
        }
937
938
        $this->buildMeta($queries);
939
940
        return $this->buildHTTPQuery($queries);
941
    }
942
}
943