JoinMeetingParameters::isExcludeFromDashboard()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
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\Parameters;
22
23
use BigBlueButton\Enum\Role;
24
25
/**
26
 * Class JoinMeetingParametersTest.
27
 */
28
class JoinMeetingParameters extends UserDataParameters
29
{
30
    private ?string $meetingId;
31
32
    private ?string $username;
33
34
    /**
35
     * @deprecated Password-string replaced by an Enum\Role-constant in JoinMeetingParameters::__construct()
36
     */
37
    private ?string $password = null;
38
39
    private ?string $userId = null;
40
41
    private ?string $webVoiceConf = null;
42
43
    private ?float $creationTime = null;
44
45
    private ?string $avatarURL = null;
46
47
    private ?bool $redirect = null;
48
49
    /**
50
     * @var array<string, string>
51
     */
52
    private array $customParameters;
53
54
    private ?string $role = null;
55
56
    private ?bool $excludeFromDashboard = null;
57
58
    private ?bool $guest = null;
59
60
    private ?string $defaultLayout = null;
61
62
    /**
63
     * @param mixed $passwordOrRole
64
     * @param mixed $meetingId
65
     * @param mixed $username
66
     */
67
    public function __construct($meetingId = null, $username = null, $passwordOrRole = null)
68
    {
69
        $this->meetingId = $meetingId;
70
        $this->username  = $username;
71
72
        if (Role::MODERATOR === $passwordOrRole || Role::VIEWER === $passwordOrRole) {
73
            $this->role = $passwordOrRole;
74
        } else {
75
            $this->password = $passwordOrRole;
0 ignored issues
show
Deprecated Code introduced by
The property BigBlueButton\Parameters...ngParameters::$password has been deprecated: Password-string replaced by an Enum\Role-constant in JoinMeetingParameters::__construct() ( Ignorable by Annotation )

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

75
            /** @scrutinizer ignore-deprecated */ $this->password = $passwordOrRole;

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
76
        }
77
        $this->customParameters = [];
78
    }
79
80
    public function getMeetingId(): ?string
81
    {
82
        return $this->meetingId;
83
    }
84
85
    public function setMeetingId(string $meetingId): JoinMeetingParameters
86
    {
87
        $this->meetingId = $meetingId;
88
89
        return $this;
90
    }
91
92
    public function getUsername(): ?string
93
    {
94
        return $this->username;
95
    }
96
97
    public function setUsername(string $username): self
98
    {
99
        $this->username = $username;
100
101
        return $this;
102
    }
103
104
    /**
105
     * @deprecated Password-string replaced by an Enum\Role-constant in JoinMeetingParameters::__construct()
106
     */
107
    public function getPassword(): ?string
108
    {
109
        return $this->password;
0 ignored issues
show
Deprecated Code introduced by
The property BigBlueButton\Parameters...ngParameters::$password has been deprecated: Password-string replaced by an Enum\Role-constant in JoinMeetingParameters::__construct() ( Ignorable by Annotation )

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

109
        return /** @scrutinizer ignore-deprecated */ $this->password;

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
110
    }
111
112
    /**
113
     *@deprecated Password-string replaced by an Enum\Role-constant in JoinMeetingParameters::__construct()
114
     */
115
    public function setPassword(string $password): self
116
    {
117
        $this->password = $password;
0 ignored issues
show
Deprecated Code introduced by
The property BigBlueButton\Parameters...ngParameters::$password has been deprecated: Password-string replaced by an Enum\Role-constant in JoinMeetingParameters::__construct() ( Ignorable by Annotation )

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

117
        /** @scrutinizer ignore-deprecated */ $this->password = $password;

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
118
119
        return $this;
120
    }
121
122
    public function getUserId(): ?string
123
    {
124
        return $this->userId;
125
    }
126
127
    public function setUserId(string $userId): self
128
    {
129
        $this->userId = $userId;
130
131
        return $this;
132
    }
133
134
    public function getWebVoiceConf(): ?string
135
    {
136
        return $this->webVoiceConf;
137
    }
138
139
    public function setWebVoiceConf(string $webVoiceConf): self
140
    {
141
        $this->webVoiceConf = $webVoiceConf;
142
143
        return $this;
144
    }
145
146
    public function getCreationTime(): ?float
147
    {
148
        return $this->creationTime;
149
    }
150
151
    public function setCreationTime(float $creationTime): self
152
    {
153
        $this->creationTime = $creationTime;
154
155
        return $this;
156
    }
157
158
    public function getAvatarURL(): ?string
159
    {
160
        return $this->avatarURL;
161
    }
162
163
    public function setAvatarURL(string $avatarURL): self
164
    {
165
        $this->avatarURL = $avatarURL;
166
167
        return $this;
168
    }
169
170
    public function isRedirect(): ?bool
171
    {
172
        return $this->redirect;
173
    }
174
175
    public function setRedirect(bool $redirect): self
176
    {
177
        $this->redirect = $redirect;
178
179
        return $this;
180
    }
181
182
    public function getRole(): ?string
183
    {
184
        return $this->role;
185
    }
186
187
    public function setRole(string $role): self
188
    {
189
        $this->role = $role;
190
191
        return $this;
192
    }
193
194
    public function isExcludeFromDashboard(): ?bool
195
    {
196
        return $this->excludeFromDashboard;
197
    }
198
199
    public function setExcludeFromDashboard(bool $excludeFromDashboard): self
200
    {
201
        $this->excludeFromDashboard = $excludeFromDashboard;
202
203
        return $this;
204
    }
205
206
    public function isGuest(): ?bool
207
    {
208
        return $this->guest;
209
    }
210
211
    public function setGuest(bool $guest): self
212
    {
213
        $this->guest = $guest;
214
215
        return $this;
216
    }
217
218
    public function getDefaultLayout(): ?string
219
    {
220
        return $this->defaultLayout;
221
    }
222
223
    public function setDefaultLayout(string $defaultLayout): self
224
    {
225
        $this->defaultLayout = $defaultLayout;
226
227
        return $this;
228
    }
229
230
    public function setCustomParameter(string $paramName, string $paramValue): self
231
    {
232
        $this->customParameters[$paramName] = $paramValue;
233
234
        return $this;
235
    }
236
237
    public function getHTTPQuery(): string
238
    {
239
        $queries = [
240
            'meetingID'            => $this->meetingId,
241
            'fullName'             => $this->username,
242
            'password'             => $this->password,
0 ignored issues
show
Deprecated Code introduced by
The property BigBlueButton\Parameters...ngParameters::$password has been deprecated: Password-string replaced by an Enum\Role-constant in JoinMeetingParameters::__construct() ( Ignorable by Annotation )

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

242
            'password'             => /** @scrutinizer ignore-deprecated */ $this->password,

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
243
            'userID'               => $this->userId,
244
            'webVoiceConf'         => $this->webVoiceConf,
245
            'createTime'           => $this->creationTime,
246
            'role'                 => $this->role,
247
            'excludeFromDashboard' => !is_null($this->excludeFromDashboard) ? ($this->excludeFromDashboard ? 'true' : 'false') : $this->excludeFromDashboard,
248
            'avatarURL'            => $this->avatarURL,
249
            'redirect'             => !is_null($this->redirect) ? ($this->redirect ? 'true' : 'false') : $this->redirect,
250
            'guest'                => !is_null($this->guest) ? ($this->guest ? 'true' : 'false') : $this->guest,
251
            'defaultLayout'        => $this->defaultLayout,
252
        ];
253
254
        foreach ($this->customParameters as $key => $value) {
255
            $queries[$key] = $value;
256
        }
257
258
        $this->buildUserData($queries);
259
260
        return $this->buildHTTPQuery($queries);
261
    }
262
}
263