Skip to content

Commit 7fd6175

Browse files
committed
Merge branch 'master' into tests/hooks
2 parents 33bf2da + af5436d commit 7fd6175

File tree

3 files changed

+148
-64
lines changed

3 files changed

+148
-64
lines changed

src/BigBlueButton.php

Lines changed: 73 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,30 @@
5959
*/
6060
class BigBlueButton
6161
{
62+
/**
63+
* @deprecated This property has been replaced by property in UrlBuilder-class.
64+
* Use property via $this->getUrlBuilder()->setSecret() and $this->getUrlBuilder()->getSecret().
65+
*/
6266
protected string $bbbSecret;
67+
68+
/**
69+
* @deprecated This property has been replaced by property in UrlBuilder-class.
70+
* Use property via $this->getUrlBuilder()->setServerBaseUrl() and $this->getUrlBuilder()->getServerBaseUrl().
71+
*/
6372
protected string $bbbBaseUrl;
64-
protected string $jSessionId;
73+
74+
/**
75+
* @deprecated This property has been replaced by property in UrlBuilder-class.
76+
* User property via $this->getUrlBuilder()->setHashingAlgorithm() and $this->getUrlBuilder()->getHashingAlgorithm().
77+
*/
6578
protected string $hashingAlgorithm;
6679

6780
/**
6881
* @var array<int, mixed>
6982
*/
7083
protected array $curlOpts = [];
7184
protected int $timeOut = 10;
85+
protected string $jSessionId;
7286

7387
private UrlBuilder $urlBuilder;
7488

@@ -94,28 +108,25 @@ public function __construct(?string $baseUrl = null, ?string $secret = null, ?ar
94108
// nor $this->bbbBaseUrl (only strings), thus FALSE will be converted automatically to an empty
95109
// string (''). Having a bool should be not possible due to the checks above and the automated
96110
// conversion, but PHPStan is still unhappy, so it's covered explicit by adding `?: ''`.
97-
$this->bbbBaseUrl = $baseUrl ?: getenv('BBB_SERVER_BASE_URL') ?: '';
98-
$this->bbbSecret = $secret ?: getenv('BBB_SECRET') ?: getenv('BBB_SECURITY_SALT') ?: '';
99-
$this->hashingAlgorithm = HashingAlgorithm::SHA_256;
100-
$this->urlBuilder = new UrlBuilder($this->bbbSecret, $this->bbbBaseUrl, $this->hashingAlgorithm);
101-
$this->curlOpts = $opts['curl'] ?? [];
102-
}
111+
$bbbBaseUrl = $baseUrl ?: getenv('BBB_SERVER_BASE_URL') ?: '';
112+
$bbbSecret = $secret ?: getenv('BBB_SECRET') ?: getenv('BBB_SECURITY_SALT') ?: '';
113+
$hashingAlgorithm = HashingAlgorithm::SHA_256;
103114

104-
/**
105-
* @deprecated Replaced by same function-name provided by UrlBuilder-class
106-
*/
107-
public function setHashingAlgorithm(string $hashingAlgorithm): void
108-
{
115+
// initialize deprecated properties
116+
$this->bbbBaseUrl = $bbbBaseUrl;
117+
$this->bbbSecret = $bbbSecret;
109118
$this->hashingAlgorithm = $hashingAlgorithm;
110-
$this->urlBuilder->setHashingAlgorithm($hashingAlgorithm);
119+
120+
$this->urlBuilder = new UrlBuilder($bbbSecret, $bbbBaseUrl, $hashingAlgorithm);
121+
$this->curlOpts = $opts['curl'] ?? [];
111122
}
112123

113124
/**
114125
* @throws BadResponseException|\RuntimeException
115126
*/
116127
public function getApiVersion(): ApiVersionResponse
117128
{
118-
$xml = $this->processXmlResponse($this->urlBuilder->buildUrl());
129+
$xml = $this->processXmlResponse($this->getUrlBuilder()->buildUrl());
119130

120131
return new ApiVersionResponse($xml);
121132
}
@@ -133,15 +144,15 @@ public function getApiVersion(): ApiVersionResponse
133144
*/
134145
public function getCreateMeetingUrl(CreateMeetingParameters $createMeetingParams): string
135146
{
136-
return $this->urlBuilder->getCreateMeetingUrl($createMeetingParams);
147+
return $this->getUrlBuilder()->getCreateMeetingUrl($createMeetingParams);
137148
}
138149

139150
/**
140151
* @throws BadResponseException|\RuntimeException
141152
*/
142153
public function createMeeting(CreateMeetingParameters $createMeetingParams): CreateMeetingResponse
143154
{
144-
$xml = $this->processXmlResponse($this->urlBuilder->getCreateMeetingUrl($createMeetingParams), $createMeetingParams->getPresentationsAsXML());
155+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getCreateMeetingUrl($createMeetingParams), $createMeetingParams->getPresentationsAsXML());
145156

146157
return new CreateMeetingResponse($xml);
147158
}
@@ -151,15 +162,15 @@ public function createMeeting(CreateMeetingParameters $createMeetingParams): Cre
151162
*/
152163
public function getJoinMeetingURL(JoinMeetingParameters $joinMeetingParams): string
153164
{
154-
return $this->urlBuilder->getJoinMeetingURL($joinMeetingParams);
165+
return $this->getUrlBuilder()->getJoinMeetingURL($joinMeetingParams);
155166
}
156167

157168
/**
158169
* @throws BadResponseException|\RuntimeException
159170
*/
160171
public function joinMeeting(JoinMeetingParameters $joinMeetingParams): JoinMeetingResponse
161172
{
162-
$xml = $this->processXmlResponse($this->urlBuilder->getJoinMeetingURL($joinMeetingParams));
173+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getJoinMeetingURL($joinMeetingParams));
163174

164175
return new JoinMeetingResponse($xml);
165176
}
@@ -169,15 +180,15 @@ public function joinMeeting(JoinMeetingParameters $joinMeetingParams): JoinMeeti
169180
*/
170181
public function getEndMeetingURL(EndMeetingParameters $endParams): string
171182
{
172-
return $this->urlBuilder->getEndMeetingURL($endParams);
183+
return $this->getUrlBuilder()->getEndMeetingURL($endParams);
173184
}
174185

175186
/**
176187
* @throws BadResponseException|\RuntimeException
177188
*/
178189
public function endMeeting(EndMeetingParameters $endParams): EndMeetingResponse
179190
{
180-
$xml = $this->processXmlResponse($this->urlBuilder->getEndMeetingURL($endParams));
191+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getEndMeetingURL($endParams));
181192

182193
return new EndMeetingResponse($xml);
183194
}
@@ -187,15 +198,15 @@ public function endMeeting(EndMeetingParameters $endParams): EndMeetingResponse
187198
*/
188199
public function getInsertDocumentUrl(InsertDocumentParameters $insertDocumentParameters): string
189200
{
190-
return $this->urlBuilder->getInsertDocumentUrl($insertDocumentParameters);
201+
return $this->getUrlBuilder()->getInsertDocumentUrl($insertDocumentParameters);
191202
}
192203

193204
/**
194205
* @throws BadResponseException|\RuntimeException
195206
*/
196207
public function insertDocument(InsertDocumentParameters $insertDocumentParams): CreateMeetingResponse
197208
{
198-
$xml = $this->processXmlResponse($this->urlBuilder->getInsertDocumentUrl($insertDocumentParams), $insertDocumentParams->getPresentationsAsXML());
209+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getInsertDocumentUrl($insertDocumentParams), $insertDocumentParams->getPresentationsAsXML());
199210

200211
return new CreateMeetingResponse($xml);
201212
}
@@ -212,15 +223,15 @@ public function insertDocument(InsertDocumentParameters $insertDocumentParams):
212223
*/
213224
public function getIsMeetingRunningUrl(IsMeetingRunningParameters $meetingParams): string
214225
{
215-
return $this->urlBuilder->getIsMeetingRunningUrl($meetingParams);
226+
return $this->getUrlBuilder()->getIsMeetingRunningUrl($meetingParams);
216227
}
217228

218229
/**
219230
* @throws BadResponseException|\RuntimeException
220231
*/
221232
public function isMeetingRunning(IsMeetingRunningParameters $meetingParams): IsMeetingRunningResponse
222233
{
223-
$xml = $this->processXmlResponse($this->urlBuilder->getIsMeetingRunningUrl($meetingParams));
234+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getIsMeetingRunningUrl($meetingParams));
224235

225236
return new IsMeetingRunningResponse($xml);
226237
}
@@ -243,15 +254,15 @@ public function isMeetingExisting(string $meetingId): bool
243254
*/
244255
public function getMeetingsUrl(): string
245256
{
246-
return $this->urlBuilder->getMeetingsUrl();
257+
return $this->getUrlBuilder()->getMeetingsUrl();
247258
}
248259

249260
/**
250261
* @throws BadResponseException|\RuntimeException
251262
*/
252263
public function getMeetings(): GetMeetingsResponse
253264
{
254-
$xml = $this->processXmlResponse($this->urlBuilder->getMeetingsUrl());
265+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getMeetingsUrl());
255266

256267
return new GetMeetingsResponse($xml);
257268
}
@@ -261,15 +272,15 @@ public function getMeetings(): GetMeetingsResponse
261272
*/
262273
public function getMeetingInfoUrl(GetMeetingInfoParameters $meetingParams): string
263274
{
264-
return $this->urlBuilder->getMeetingInfoUrl($meetingParams);
275+
return $this->getUrlBuilder()->getMeetingInfoUrl($meetingParams);
265276
}
266277

267278
/**
268279
* @throws BadResponseException|\RuntimeException
269280
*/
270281
public function getMeetingInfo(GetMeetingInfoParameters $meetingParams): GetMeetingInfoResponse
271282
{
272-
$xml = $this->processXmlResponse($this->urlBuilder->getMeetingInfoUrl($meetingParams));
283+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getMeetingInfoUrl($meetingParams));
273284

274285
return new GetMeetingInfoResponse($xml);
275286
}
@@ -286,7 +297,7 @@ public function getMeetingInfo(GetMeetingInfoParameters $meetingParams): GetMeet
286297
*/
287298
public function getRecordingsUrl(GetRecordingsParameters $recordingsParams): string
288299
{
289-
return $this->urlBuilder->getRecordingsUrl($recordingsParams);
300+
return $this->getUrlBuilder()->getRecordingsUrl($recordingsParams);
290301
}
291302

292303
/**
@@ -296,7 +307,7 @@ public function getRecordingsUrl(GetRecordingsParameters $recordingsParams): str
296307
*/
297308
public function getRecordings($recordingParams): GetRecordingsResponse
298309
{
299-
$xml = $this->processXmlResponse($this->urlBuilder->getRecordingsUrl($recordingParams));
310+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getRecordingsUrl($recordingParams));
300311

301312
return new GetRecordingsResponse($xml);
302313
}
@@ -306,15 +317,15 @@ public function getRecordings($recordingParams): GetRecordingsResponse
306317
*/
307318
public function getPublishRecordingsUrl(PublishRecordingsParameters $recordingParams): string
308319
{
309-
return $this->urlBuilder->getPublishRecordingsUrl($recordingParams);
320+
return $this->getUrlBuilder()->getPublishRecordingsUrl($recordingParams);
310321
}
311322

312323
/**
313324
* @throws BadResponseException
314325
*/
315326
public function publishRecordings(PublishRecordingsParameters $recordingParams): PublishRecordingsResponse
316327
{
317-
$xml = $this->processXmlResponse($this->urlBuilder->getPublishRecordingsUrl($recordingParams));
328+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getPublishRecordingsUrl($recordingParams));
318329

319330
return new PublishRecordingsResponse($xml);
320331
}
@@ -324,15 +335,15 @@ public function publishRecordings(PublishRecordingsParameters $recordingParams):
324335
*/
325336
public function getDeleteRecordingsUrl(DeleteRecordingsParameters $recordingParams): string
326337
{
327-
return $this->urlBuilder->getDeleteRecordingsUrl($recordingParams);
338+
return $this->getUrlBuilder()->getDeleteRecordingsUrl($recordingParams);
328339
}
329340

330341
/**
331342
* @throws BadResponseException|\RuntimeException
332343
*/
333344
public function deleteRecordings(DeleteRecordingsParameters $recordingParams): DeleteRecordingsResponse
334345
{
335-
$xml = $this->processXmlResponse($this->urlBuilder->getDeleteRecordingsUrl($recordingParams));
346+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getDeleteRecordingsUrl($recordingParams));
336347

337348
return new DeleteRecordingsResponse($xml);
338349
}
@@ -342,15 +353,15 @@ public function deleteRecordings(DeleteRecordingsParameters $recordingParams): D
342353
*/
343354
public function getUpdateRecordingsUrl(UpdateRecordingsParameters $recordingParams): string
344355
{
345-
return $this->urlBuilder->getUpdateRecordingsUrl($recordingParams);
356+
return $this->getUrlBuilder()->getUpdateRecordingsUrl($recordingParams);
346357
}
347358

348359
/**
349360
* @throws BadResponseException|\RuntimeException
350361
*/
351362
public function updateRecordings(UpdateRecordingsParameters $recordingParams): UpdateRecordingsResponse
352363
{
353-
$xml = $this->processXmlResponse($this->urlBuilder->getUpdateRecordingsUrl($recordingParams));
364+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getUpdateRecordingsUrl($recordingParams));
354365

355366
return new UpdateRecordingsResponse($xml);
356367
}
@@ -360,15 +371,15 @@ public function updateRecordings(UpdateRecordingsParameters $recordingParams): U
360371
*/
361372
public function getRecordingTextTracksUrl(GetRecordingTextTracksParameters $getRecordingTextTracksParameters): string
362373
{
363-
return $this->urlBuilder->getRecordingTextTracksUrl($getRecordingTextTracksParameters);
374+
return $this->getUrlBuilder()->getRecordingTextTracksUrl($getRecordingTextTracksParameters);
364375
}
365376

366377
/**
367378
* @throws BadResponseException
368379
*/
369380
public function getRecordingTextTracks(GetRecordingTextTracksParameters $getRecordingTextTracksParams): GetRecordingTextTracksResponse
370381
{
371-
$json = $this->processJsonResponse($this->urlBuilder->getRecordingTextTracksUrl($getRecordingTextTracksParams));
382+
$json = $this->processJsonResponse($this->getUrlBuilder()->getRecordingTextTracksUrl($getRecordingTextTracksParams));
372383

373384
return new GetRecordingTextTracksResponse($json);
374385
}
@@ -378,15 +389,15 @@ public function getRecordingTextTracks(GetRecordingTextTracksParameters $getReco
378389
*/
379390
public function getPutRecordingTextTrackUrl(PutRecordingTextTrackParameters $putRecordingTextTrackParams): string
380391
{
381-
return $this->urlBuilder->getPutRecordingTextTrackUrl($putRecordingTextTrackParams);
392+
return $this->getUrlBuilder()->getPutRecordingTextTrackUrl($putRecordingTextTrackParams);
382393
}
383394

384395
/**
385396
* @throws BadResponseException
386397
*/
387398
public function putRecordingTextTrack(PutRecordingTextTrackParameters $putRecordingTextTrackParams): PutRecordingTextTrackResponse
388399
{
389-
$json = $this->processJsonResponse($this->urlBuilder->getPutRecordingTextTrackUrl($putRecordingTextTrackParams));
400+
$json = $this->processJsonResponse($this->getUrlBuilder()->getPutRecordingTextTrackUrl($putRecordingTextTrackParams));
390401

391402
return new PutRecordingTextTrackResponse($json);
392403
}
@@ -398,7 +409,7 @@ public function putRecordingTextTrack(PutRecordingTextTrackParameters $putRecord
398409
*/
399410
public function getHooksCreateUrl(HooksCreateParameters $hookCreateParams): string
400411
{
401-
return $this->urlBuilder->getHooksCreateUrl($hookCreateParams);
412+
return $this->getUrlBuilder()->getHooksCreateUrl($hookCreateParams);
402413
}
403414

404415
/**
@@ -408,7 +419,7 @@ public function getHooksCreateUrl(HooksCreateParameters $hookCreateParams): stri
408419
*/
409420
public function hooksCreate($hookCreateParams): HooksCreateResponse
410421
{
411-
$xml = $this->processXmlResponse($this->urlBuilder->getHooksCreateUrl($hookCreateParams));
422+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getHooksCreateUrl($hookCreateParams));
412423

413424
return new HooksCreateResponse($xml);
414425
}
@@ -418,15 +429,15 @@ public function hooksCreate($hookCreateParams): HooksCreateResponse
418429
*/
419430
public function getHooksListUrl(): string
420431
{
421-
return $this->urlBuilder->getHooksListUrl();
432+
return $this->getUrlBuilder()->getHooksListUrl();
422433
}
423434

424435
/**
425436
* @throws BadResponseException
426437
*/
427438
public function hooksList(): HooksListResponse
428439
{
429-
$xml = $this->processXmlResponse($this->urlBuilder->getHooksListUrl());
440+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getHooksListUrl());
430441

431442
return new HooksListResponse($xml);
432443
}
@@ -436,7 +447,7 @@ public function hooksList(): HooksListResponse
436447
*/
437448
public function getHooksDestroyUrl(HooksDestroyParameters $hooksDestroyParams): string
438449
{
439-
return $this->urlBuilder->getHooksDestroyUrl($hooksDestroyParams);
450+
return $this->getUrlBuilder()->getHooksDestroyUrl($hooksDestroyParams);
440451
}
441452

442453
/**
@@ -446,7 +457,7 @@ public function getHooksDestroyUrl(HooksDestroyParameters $hooksDestroyParams):
446457
*/
447458
public function hooksDestroy($hooksDestroyParams): HooksDestroyResponse
448459
{
449-
$xml = $this->processXmlResponse($this->urlBuilder->getHooksDestroyUrl($hooksDestroyParams));
460+
$xml = $this->processXmlResponse($this->getUrlBuilder()->getHooksDestroyUrl($hooksDestroyParams));
450461

451462
return new HooksDestroyResponse($xml);
452463
}
@@ -481,8 +492,22 @@ public function setTimeOut(int $TimeOutInSeconds): self
481492
return $this;
482493
}
483494

495+
public function setHashingAlgorithm(string $hashingAlgorithm): void
496+
{
497+
$this->hashingAlgorithm = $hashingAlgorithm;
498+
$this->getUrlBuilder()->setHashingAlgorithm($hashingAlgorithm);
499+
}
500+
501+
public function getHashingAlgorithm(string $hashingAlgorithm): string
502+
{
503+
$this->hashingAlgorithm = $this->getUrlBuilder()->getHashingAlgorithm();
504+
505+
return $this->getUrlBuilder()->getHashingAlgorithm();
506+
}
507+
484508
/**
485-
* @deprecated replaced by same function-name provided by UrlBuilder-BigBlueButton
509+
* @deprecated Replaced by same function-name provided in UrlBuilder-class.
510+
* Access via $this->getUrlBuilder()->buildUrl()
486511
*
487512
* Public accessor for buildUrl
488513
*/
@@ -587,7 +612,7 @@ private function sendRequest(string $url, string $payload = '', string $contentT
587612
*/
588613
private function processXmlResponse(string $url, string $payload = ''): \SimpleXMLElement
589614
{
590-
$response = $this->sendRequest($url, $payload, $contentType);
615+
$response = $this->sendRequest($url, $payload, 'application/xml');
591616

592617
return new \SimpleXMLElement($response);
593618
}

0 commit comments

Comments
 (0)