Skip to content

Commit edc3b71

Browse files
authored
Merge pull request #247 from DigitalTimK/enhancement/parameterConstructors
Improve parameter constructors
2 parents bfcf3ca + c87e59d commit edc3b71

17 files changed

Lines changed: 71 additions & 132 deletions

src/BigBlueButton.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,9 @@ public function getRecordingsUrl(GetRecordingsParameters $recordingsParams): str
302302
}
303303

304304
/**
305-
* @param mixed $recordingParams
306-
*
307305
* @throws BadResponseException|\RuntimeException
308306
*/
309-
public function getRecordings($recordingParams): GetRecordingsResponse
307+
public function getRecordings(GetRecordingsParameters $recordingParams): GetRecordingsResponse
310308
{
311309
$xml = $this->processXmlResponse($this->getUrlBuilder()->getRecordingsUrl($recordingParams));
312310

@@ -414,11 +412,9 @@ public function getHooksCreateUrl(HooksCreateParameters $hookCreateParams): stri
414412
}
415413

416414
/**
417-
* @param mixed $hookCreateParams
418-
*
419415
* @throws BadResponseException
420416
*/
421-
public function hooksCreate($hookCreateParams): HooksCreateResponse
417+
public function hooksCreate(HooksCreateParameters $hookCreateParams): HooksCreateResponse
422418
{
423419
$xml = $this->processXmlResponse($this->getUrlBuilder()->getHooksCreateUrl($hookCreateParams));
424420

@@ -452,11 +448,9 @@ public function getHooksDestroyUrl(HooksDestroyParameters $hooksDestroyParams):
452448
}
453449

454450
/**
455-
* @param mixed $hooksDestroyParams
456-
*
457451
* @throws BadResponseException
458452
*/
459-
public function hooksDestroy($hooksDestroyParams): HooksDestroyResponse
453+
public function hooksDestroy(HooksDestroyParameters $hooksDestroyParams): HooksDestroyResponse
460454
{
461455
$xml = $this->processXmlResponse($this->getUrlBuilder()->getHooksDestroyUrl($hooksDestroyParams));
462456

src/Core/Track.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ class Track
3535

3636
private string $source;
3737

38-
/**
39-
* @param mixed $track
40-
*/
41-
public function __construct($track)
38+
public function __construct(mixed $track)
4239
{
4340
$this->href = $track->href;
4441
$this->kind = $track->kind;

src/Parameters/CreateMeetingParameters.php

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class CreateMeetingParameters extends MetaParameters
2929
{
3030
use DocumentableTrait;
3131

32-
private ?string $meetingId = null;
32+
private string $meetingId;
3333

34-
private ?string $meetingName = null;
34+
private string $meetingName;
3535

3636
/**
3737
* @deprecated Password-string replaced by an Enum\Role-constant in JoinMeetingParameters::__construct()
@@ -183,11 +183,8 @@ class CreateMeetingParameters extends MetaParameters
183183

184184
/**
185185
* CreateMeetingParameters constructor.
186-
*
187-
* @param mixed $meetingId
188-
* @param mixed $meetingName
189186
*/
190-
public function __construct($meetingId = null, $meetingName = null)
187+
public function __construct(string $meetingId, string $meetingName)
191188
{
192189
$this->meetingId = $meetingId;
193190
$this->meetingName = $meetingName;
@@ -609,12 +606,9 @@ public function isVirtualBackgroundsDisabled(): ?bool
609606
* Default: false
610607
*
611608
* @since 2.4.3
612-
*
613-
* @param mixed $virtualBackgroundsDisabled
614-
*
615609
* @deprecated Removed in 2.5, temporarily still handled, please transition to disabledFeatures.
616610
*/
617-
public function setVirtualBackgroundsDisabled($virtualBackgroundsDisabled): self
611+
public function setVirtualBackgroundsDisabled(bool $virtualBackgroundsDisabled): self
618612
{
619613
$this->virtualBackgroundsDisabled = $virtualBackgroundsDisabled;
620614

@@ -998,10 +992,7 @@ public function setEndCallbackUrl($endCallbackUrl): self
998992
return $this;
999993
}
1000994

1001-
/**
1002-
* @param mixed $recordingReadyCallbackUrl
1003-
*/
1004-
public function setRecordingReadyCallbackUrl($recordingReadyCallbackUrl): self
995+
public function setRecordingReadyCallbackUrl(string $recordingReadyCallbackUrl): self
1005996
{
1006997
$this->addMeta('bbb-recording-ready-url', $recordingReadyCallbackUrl);
1007998

@@ -1102,11 +1093,9 @@ public function isBreakoutRoomsEnabled(): ?bool
11021093
*
11031094
* Default: true
11041095
*
1105-
* @param mixed $breakoutRoomsEnabled
1106-
*
11071096
* @deprecated Removed in 2.5, temporarily still handled, please transition to disabledFeatures.
11081097
*/
1109-
public function setBreakoutRoomsEnabled($breakoutRoomsEnabled): self
1098+
public function setBreakoutRoomsEnabled(bool $breakoutRoomsEnabled): self
11101099
{
11111100
$this->breakoutRoomsEnabled = $breakoutRoomsEnabled;
11121101

@@ -1195,10 +1184,8 @@ public function isAllowRequestsWithoutSession(): ?bool
11951184
* Default: false
11961185
*
11971186
* @since 2.4.3
1198-
*
1199-
* @param mixed $allowRequestsWithoutSession
12001187
*/
1201-
public function setAllowRequestsWithoutSession($allowRequestsWithoutSession): self
1188+
public function setAllowRequestsWithoutSession(bool $allowRequestsWithoutSession): self
12021189
{
12031190
$this->allowRequestsWithoutSession = $allowRequestsWithoutSession;
12041191

@@ -1447,11 +1434,9 @@ public function getBreakoutRoomsGroups(): array
14471434
}
14481435

14491436
/**
1450-
* @param mixed $id
1451-
* @param mixed $name
1452-
* @param mixed $roster
1437+
* @param array<int, string> $roster
14531438
*/
1454-
public function addBreakoutRoomsGroup($id, $name, $roster): self
1439+
public function addBreakoutRoomsGroup(mixed $id, string $name, array $roster): self
14551440
{
14561441
$this->breakoutRoomsGroups[] = ['id' => $id, 'name' => $name, 'roster' => $roster];
14571442

src/Parameters/DeleteRecordingsParameters.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
*/
2828
class DeleteRecordingsParameters extends BaseParameters
2929
{
30-
private ?string $recordingId = null;
30+
private string $recordingId;
3131

32-
public function __construct(?string $recordingId = null)
32+
public function __construct(string $recordingId)
3333
{
3434
$this->recordingId = $recordingId;
3535
}
@@ -40,7 +40,7 @@ public function getRecordingId(): ?string
4040
return $this->recordingId;
4141
}
4242

43-
public function setRecordingId(string $recordingId): DeleteRecordingsParameters
43+
public function setRecordingId(string $recordingId): self
4444
{
4545
$this->recordingId = $recordingId;
4646

src/Parameters/EndMeetingParameters.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@
2727
*/
2828
class EndMeetingParameters extends BaseParameters
2929
{
30-
private ?string $meetingId = null;
30+
private string $meetingId;
3131

3232
/**
33+
* The password of the moderator.
34+
*
3335
* @deprecated
3436
*/
35-
private ?string $password = null;
37+
private ?string $password;
3638

37-
public function __construct(?string $meetingId = null, ?string $password = null)
39+
public function __construct(string $meetingId, ?string $password = null)
3840
{
3941
$this->password = $password;
4042
$this->meetingId = $meetingId;
@@ -65,7 +67,7 @@ public function getPassword(): ?string
6567
/**
6668
* @deprecated
6769
*/
68-
public function setPassword(string $password): self
70+
public function setPassword(?string $password): self
6971
{
7072
$this->password = $password;
7173

src/Parameters/GetMeetingInfoParameters.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
*/
2828
class GetMeetingInfoParameters extends BaseParameters
2929
{
30-
private ?string $meetingId = null;
30+
private string $meetingId;
3131

3232
private ?int $offset = null;
3333

3434
private ?int $limit = null;
3535

36-
public function __construct(?string $meetingId = null)
36+
public function __construct(string $meetingId)
3737
{
3838
$this->meetingId = $meetingId;
3939
}
@@ -57,7 +57,7 @@ public function getOffset(): ?int
5757
return $this->offset;
5858
}
5959

60-
public function setOffset(int $offset): self
60+
public function setOffset(?int $offset): self
6161
{
6262
$this->offset = $offset;
6363

@@ -70,7 +70,7 @@ public function getLimit(): ?int
7070
return $this->limit;
7171
}
7272

73-
public function setLimit(int $limit): self
73+
public function setLimit(?int $limit): self
7474
{
7575
$this->limit = $limit;
7676

src/Parameters/GetRecordingTextTracksParameters.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
*/
2828
class GetRecordingTextTracksParameters extends MetaParameters
2929
{
30-
private ?string $recordId = null;
30+
private string $recordId;
3131

3232
/**
3333
* GetRecordingTextTracksParameters constructor.
3434
*/
35-
public function __construct(?string $recordId = null)
35+
public function __construct(string $recordId)
3636
{
3737
$this->recordId = $recordId;
3838
}

src/Parameters/InsertDocumentParameters.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class InsertDocumentParameters extends BaseParameters
2929
{
3030
use DocumentableTrait;
3131

32-
private ?string $meetingId = null;
32+
private string $meetingId;
3333

34-
public function __construct(?string $meetingId = null)
34+
public function __construct(string $meetingId)
3535
{
3636
$this->meetingId = $meetingId;
3737
}

src/Parameters/IsMeetingRunningParameters.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
*/
2828
class IsMeetingRunningParameters extends BaseParameters
2929
{
30-
private ?string $meetingId = null;
30+
private string $meetingId;
3131

32-
public function __construct(?string $meetingId = null)
32+
public function __construct(string $meetingId)
3333
{
3434
$this->meetingId = $meetingId;
3535
}

src/Parameters/JoinMeetingParameters.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
*/
2929
class JoinMeetingParameters extends UserDataParameters
3030
{
31-
private ?string $meetingId;
31+
private string $meetingId;
3232

33-
private ?string $username;
33+
private string $username;
3434

3535
/**
3636
* @deprecated Password-string replaced by an Enum\Role-constant in JoinMeetingParameters::__construct()
@@ -50,7 +50,7 @@ class JoinMeetingParameters extends UserDataParameters
5050
/**
5151
* @var array<string, string>
5252
*/
53-
private array $customParameters;
53+
private array $customParameters = [];
5454

5555
private ?string $role = null;
5656

@@ -60,12 +60,7 @@ class JoinMeetingParameters extends UserDataParameters
6060

6161
private ?string $defaultLayout = null;
6262

63-
/**
64-
* @param mixed $passwordOrRole
65-
* @param mixed $meetingId
66-
* @param mixed $username
67-
*/
68-
public function __construct($meetingId = null, $username = null, $passwordOrRole = null)
63+
public function __construct(string $meetingId, string $username, string $passwordOrRole)
6964
{
7065
$this->meetingId = $meetingId;
7166
$this->username = $username;
@@ -75,7 +70,6 @@ public function __construct($meetingId = null, $username = null, $passwordOrRole
7570
} else {
7671
$this->password = $passwordOrRole;
7772
}
78-
$this->customParameters = [];
7973
}
8074

8175
#[ApiParameterMapper(attributeName: 'meetingID')]
@@ -84,7 +78,7 @@ public function getMeetingId(): ?string
8478
return $this->meetingId;
8579
}
8680

87-
public function setMeetingId(string $meetingId): JoinMeetingParameters
81+
public function setMeetingId(string $meetingId): self
8882
{
8983
$this->meetingId = $meetingId;
9084

@@ -116,7 +110,7 @@ public function getPassword(): ?string
116110
/**
117111
*@deprecated Password-string replaced by an Enum\Role-constant in JoinMeetingParameters::__construct()
118112
*/
119-
public function setPassword(string $password): self
113+
public function setPassword(?string $password): self
120114
{
121115
$this->password = $password;
122116

@@ -255,7 +249,7 @@ public function getHTTPQuery(): string
255249
$queries[$key] = $value;
256250
}
257251

258-
$queries = $this->buildUserData($queries);
252+
$this->buildUserData($queries);
259253

260254
return $this->buildHTTPQuery($queries);
261255
}

0 commit comments

Comments
 (0)