Attendee::hasJoinedVoice()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
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-2024 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 <https://www.gnu.org/licenses/>.
19
 */
20
21
namespace BigBlueButton\Core;
22
23
class Attendee
24
{
25
    private string $userId;
26
27
    private string $fullName;
28
29
    private string $role;
30
31
    private bool $isPresenter;
32
33
    private bool $isListeningOnly;
34
35
    private bool $hasJoinedVoice;
36
37
    private bool $hasVideo;
38
39
    /**
40
     * @var array<string, string>
41
     */
42
    private array $customData = [];
43
44
    private string $clientType;
45
46
    public function __construct(\SimpleXMLElement $xml)
47
    {
48
        $this->userId          = $xml->userID->__toString();
49
        $this->fullName        = $xml->fullName->__toString();
50
        $this->role            = $xml->role->__toString();
51
        $this->isPresenter     = 'true' === $xml->isPresenter->__toString();
52
        $this->isListeningOnly = 'true' === $xml->isListeningOnly->__toString();
53
        $this->hasJoinedVoice  = 'true' === $xml->hasJoinedVoice->__toString();
54
        $this->hasVideo        = 'true' === $xml->hasVideo->__toString();
55
        $this->clientType      = $xml->clientType->__toString();
56
57
        if ($xml->customdata) {
58
            foreach ($xml->customdata->children() as $data) {
59
                $this->customData[$data->getName()] = $data->__toString();
60
            }
61
        }
62
    }
63
64
    public function getUserId(): string
65
    {
66
        return $this->userId;
67
    }
68
69
    public function getFullName(): string
70
    {
71
        return $this->fullName;
72
    }
73
74
    public function getRole(): string
75
    {
76
        return $this->role;
77
    }
78
79
    public function isPresenter(): ?bool
80
    {
81
        return $this->isPresenter;
82
    }
83
84
    public function isListeningOnly(): ?bool
85
    {
86
        return $this->isListeningOnly;
87
    }
88
89
    public function hasJoinedVoice(): ?bool
90
    {
91
        return $this->hasJoinedVoice;
92
    }
93
94
    public function hasVideo(): ?bool
95
    {
96
        return $this->hasVideo;
97
    }
98
99
    public function getClientType(): string
100
    {
101
        return $this->clientType;
102
    }
103
104
    /**
105
     * @return array<string, string>
106
     */
107
    public function getCustomData(): array
108
    {
109
        return $this->customData;
110
    }
111
}
112