Attendee   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 87
Duplicated Lines 0 %

Importance

Changes 3
Bugs 2 Features 0
Metric Value
wmc 12
eloc 30
c 3
b 2
f 0
dl 0
loc 87
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getClientType() 0 3 1
A hasJoinedVoice() 0 3 1
A getRole() 0 3 1
A getUserId() 0 3 1
A __construct() 0 14 3
A isPresenter() 0 3 1
A hasVideo() 0 3 1
A getCustomData() 0 3 1
A getFullName() 0 3 1
A isListeningOnly() 0 3 1
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