Skip to content

Commit 6710d96

Browse files
committed
Move userdata property to JoinMeetingParameters
1 parent f461e1a commit 6710d96

File tree

9 files changed

+80
-35
lines changed

9 files changed

+80
-35
lines changed

src/Core/Attendee.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ class Attendee
5555
*/
5656
private $hasVideo;
5757

58+
/**
59+
* @var array
60+
*/
61+
private $customData;
62+
63+
/**
64+
* @var string
65+
*/
66+
private $clientType;
67+
5868
/**
5969
* Attendee constructor.
6070
* @param $xml \SimpleXMLElement
@@ -68,6 +78,11 @@ public function __construct($xml)
6878
$this->isListeningOnly = $xml->isListeningOnly->__toString() === 'true';
6979
$this->hasJoinedVoice = $xml->hasJoinedVoice->__toString() === 'true';
7080
$this->hasVideo = $xml->hasVideo->__toString() === 'true';
81+
$this->clientType = $xml->clientType->__toString();
82+
83+
foreach ($xml->customdata->children() as $data) {
84+
$this->customData[$data->getName()] = $data->__toString();
85+
}
7186
}
7287

7388
/**
@@ -125,4 +140,20 @@ public function hasVideo()
125140
{
126141
return $this->hasVideo;
127142
}
143+
144+
/**
145+
* @return string
146+
*/
147+
public function getClientType()
148+
{
149+
return $this->clientType;
150+
}
151+
152+
/**
153+
* @return array
154+
*/
155+
public function getCustomData()
156+
{
157+
return $this->customData;
158+
}
128159
}

src/Parameters/CreateMeetingParameters.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
* Class CreateMeetingParameters.
2323
*/
24-
class CreateMeetingParameters extends UserDataParameters
24+
class CreateMeetingParameters extends MetaParameters
2525
{
2626
/**
2727
* @var string
@@ -713,7 +713,6 @@ public function getHTTPQuery()
713713
}
714714

715715
$this->buildMeta($queries);
716-
$this->buildUserData($queries);
717716

718717
return $this->buildHTTPQuery($queries);
719718
}

src/Parameters/JoinMeetingParameters.php

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
* Class JoinMeetingParametersTest.
2323
*/
24-
class JoinMeetingParameters extends BaseParameters
24+
class JoinMeetingParameters extends UserDataParameters
2525
{
2626
/**
2727
* @var string
@@ -312,20 +312,21 @@ public function setJoinViaHtml5($joinViaHtml5)
312312
*/
313313
public function getHTTPQuery()
314314
{
315-
return $this->buildHTTPQuery(
316-
[
317-
'meetingID' => $this->meetingId,
318-
'fullName' => $this->username,
319-
'password' => $this->password,
320-
'userID' => $this->userId,
321-
'webVoiceConf' => $this->webVoiceConf,
322-
'createTime' => $this->creationTime,
323-
'configToken' => $this->configToken,
324-
'avatarURL' => $this->avatarURL,
325-
'redirect' => $this->redirect ? 'true' : 'false',
326-
'joinViaHtml5' => $this->joinViaHtml5 ? 'true' : 'false',
327-
'clientURL' => $this->clientURL
328-
]
329-
);
315+
$queries = [
316+
'meetingID' => $this->meetingId,
317+
'fullName' => $this->username,
318+
'password' => $this->password,
319+
'userID' => $this->userId,
320+
'webVoiceConf' => $this->webVoiceConf,
321+
'createTime' => $this->creationTime,
322+
'configToken' => $this->configToken,
323+
'avatarURL' => $this->avatarURL,
324+
'redirect' => $this->redirect ? 'true' : 'false',
325+
'joinViaHtml5' => $this->joinViaHtml5 ? 'true' : 'false',
326+
'clientURL' => $this->clientURL
327+
];
328+
$this->buildUserData($queries);
329+
330+
return $this->buildHTTPQuery($queries);
330331
}
331332
}

src/Parameters/UserDataParameters.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
*
1616
* You should have received a copy of the GNU Lesser General Public License along
1717
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
18-
*/
18+
*/
1919
namespace BigBlueButton\Parameters;
2020

2121
/**
2222
* Class UserDataParameters
2323
* @package BigBlueButton\Parameters
2424
*/
25-
abstract class UserDataParameters extends MetaParameters
25+
abstract class UserDataParameters extends BaseParameters
2626
{
2727
/**
2828
* @var array

tests/Parameters/CreateMeetingParametersTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public function testCreateMeetingParameters()
5252
$this->assertEquals($params['muteOnStart'], $createMeetingParams->isMuteOnStart());
5353
$this->assertEquals($params['meta_presenter'], $createMeetingParams->getMeta('presenter'));
5454
$this->assertEquals($params['meta_endCallbackUrl'], $createMeetingParams->getMeta('endCallbackUrl'));
55-
$this->assertEquals($params['userdata_countrycode'], $createMeetingParams->getUserData('countrycode'));
5655

5756
// Check values are empty of this is not a breakout room
5857
$this->assertNull($createMeetingParams->isBreakout());

tests/Parameters/JoinMeetingParametersTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function testJoinMeetingParameters()
3333
$this->assertEquals($params['userId'], $joinMeetingParams->getUserId());
3434
$this->assertEquals($params['webVoiceConf'], $joinMeetingParams->getWebVoiceConf());
3535
$this->assertEquals($params['creationTime'], $joinMeetingParams->getCreationTime());
36+
$this->assertEquals($params['userdata_countrycode'], $joinMeetingParams->getUserData('countrycode'));
3637

3738
// Test setters that are ignored by the constructor
3839
$joinMeetingParams->setMeetingId($newId = $this->faker->uuid);

tests/Responses/GetMeetingInfoResponseTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,14 @@ public function testMeetingAttendeeContent()
7676
$this->assertEquals(false, $anAttendee->isListeningOnly());
7777
$this->assertEquals(true, $anAttendee->hasJoinedVoice());
7878
$this->assertEquals(false, $anAttendee->hasVideo());
79+
$this->assertEquals('FLASH', $anAttendee->getClientType());
7980
$this->assertCount(2, $this->meetingInfo->getAttendees());
81+
82+
$customData = $anAttendee->getCustomData();
83+
$this->assertEquals(3, sizeof($customData));
84+
$this->assertEquals('true', $customData['skipCheck']);
85+
$this->assertEquals('#FF0033', $customData['backgroundColor']);
86+
$this->assertEquals('a:focus{color:#0181eb}', $customData['customStyle']);
8087
}
8188

8289
public function testGetMeetingInfoResponseTypes()
@@ -95,7 +102,7 @@ public function testGetMeetingInfoResponseTypes()
95102

96103
$anAttendee = $this->meetingInfo->getAttendees()[1];
97104

98-
$this->assertEachGetterValueIsString($anAttendee, ['getUserId', 'getFullName', 'getRole']);
105+
$this->assertEachGetterValueIsString($anAttendee, ['getUserId', 'getFullName', 'getRole', 'getClientType']);
99106
$this->assertEachGetterValueIsBoolean($anAttendee, ['isPresenter', 'isListeningOnly', 'hasJoinedVoice', 'hasVideo']);
100107
}
101108

tests/TestCase.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ protected function generateCreateParams()
8787
'copyright' => $this->faker->text,
8888
'muteOnStart' => $this->faker->boolean(50),
8989
'meta_presenter' => $this->faker->name,
90-
'meta_endCallbackUrl' => $this->faker->url,
91-
'userdata_countrycode' => $this->faker->countryCode
90+
'meta_endCallbackUrl' => $this->faker->url
9291
];
9392
}
9493

@@ -121,8 +120,7 @@ protected function getCreateMock($params)
121120
->setDuration($params['duration'])->setWelcomeMessage($params['welcomeMessage'])->setAutoStartRecording($params['autoStartRecording'])
122121
->setAllowStartStopRecording($params['allowStartStopRecording'])->setModeratorOnlyMessage($params['moderatorOnlyMessage'])
123122
->setWebcamsOnlyForModerator($params['webcamsOnlyForModerator'])->setLogo($params['logo'])->setCopyright($params['copyright'])
124-
->setEndCallbackUrl($params['meta_endCallbackUrl'])->setMuteOnStart($params['muteOnStart'])->addMeta('presenter', $params['meta_presenter'])
125-
->addUserData('countrycode', $params['userdata_countrycode']);
123+
->setEndCallbackUrl($params['meta_endCallbackUrl'])->setMuteOnStart($params['muteOnStart'])->addMeta('presenter', $params['meta_presenter']);
126124
}
127125

128126
/**
@@ -143,12 +141,14 @@ protected function getBreakoutCreateMock($params)
143141
*/
144142
protected function generateJoinMeetingParams()
145143
{
146-
return ['meetingId' => $this->faker->uuid,
147-
'userName' => $this->faker->name,
148-
'password' => $this->faker->password,
149-
'userId' => $this->faker->numberBetween(1, 1000),
150-
'webVoiceConf' => $this->faker->word,
151-
'creationTime' => $this->faker->unixTime];
144+
return ['meetingId' => $this->faker->uuid,
145+
'userName' => $this->faker->name,
146+
'password' => $this->faker->password,
147+
'userId' => $this->faker->numberBetween(1, 1000),
148+
'webVoiceConf' => $this->faker->word,
149+
'creationTime' => $this->faker->unixTime,
150+
'userdata_countrycode' => $this->faker->countryCode
151+
];
152152
}
153153

154154
/**
@@ -160,7 +160,8 @@ protected function getJoinMeetingMock($params)
160160
{
161161
$joinMeetingParams = new JoinMeetingParameters($params['meetingId'], $params['userName'], $params['password']);
162162

163-
return $joinMeetingParams->setUserId($params['userId'])->setWebVoiceConf($params['webVoiceConf'])->setCreationTime($params['creationTime']);
163+
return $joinMeetingParams->setUserId($params['userId'])->setWebVoiceConf($params['webVoiceConf'])
164+
->setCreationTime($params['creationTime'])->addUserData('countrycode', $params['userdata_countrycode']);
164165
}
165166

166167
/**

tests/fixtures/get_meeting_info.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<isListeningOnly>false</isListeningOnly>
3333
<hasJoinedVoice>true</hasJoinedVoice>
3434
<hasVideo>true</hasVideo>
35+
<clientType>HTML5</clientType>
3536
<customdata></customdata>
3637
</attendee>
3738
<attendee>
@@ -42,7 +43,12 @@
4243
<isListeningOnly>false</isListeningOnly>
4344
<hasJoinedVoice>true</hasJoinedVoice>
4445
<hasVideo>false</hasVideo>
45-
<customdata></customdata>
46+
<clientType>FLASH</clientType>
47+
<customdata>
48+
<skipCheck>true</skipCheck>
49+
<backgroundColor>#FF0033</backgroundColor>
50+
<customStyle>a:focus{color:#0181eb}</customStyle>
51+
</customdata>
4652
</attendee>
4753
</attendees>
4854
<isBreakout>true</isBreakout>
@@ -52,7 +58,7 @@
5258
<bbb-context>Best BBB Developers Club</bbb-context>
5359
<bn-origin>Moodle</bn-origin>
5460
<bn-recording-ready-url>
55-
http://bigbluebutton.org/moodle/mod/bigbluebuttonbn/bbb_broker.php?action=recording_ready
61+
http://bigbluebutton.org/moodle/mod/bigbluebuttonbn/bbb_broker.php?action=recording_ready
5662
</bn-recording-ready-url>
5763
<bbb-origin-tag>moodle-mod_bigbluebuttonbn (2015080609)</bbb-origin-tag>
5864
<bbb-origin-version>3.0.2 (Build: 20160111)</bbb-origin-version>

0 commit comments

Comments
 (0)