Skip to content

Commit 205592c

Browse files
committed
Updated code to our standards
1 parent ec7251b commit 205592c

8 files changed

Lines changed: 72 additions & 47 deletions

src/BigBlueButton.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -566,14 +566,7 @@ private function requestUrl(string $url, string $payload = '', string $contentTy
566566
return $response->getBody();
567567
}
568568

569-
/**
570-
* Public accessor for buildUrl
571-
* @param string $method
572-
* @param string $params
573-
* @param bool $append
574-
* @return string
575-
*/
576-
public function buildUrl($method = '', $params = '', $append = true)
569+
public function buildUrl(string $method = '', string $params = '', bool $append = true): string
577570
{
578571
return $this->urlBuilder->buildUrl($method, $params, $append);
579572
}

src/Core/GuestPolicy.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
/**
36
* BigBlueButton open source conferencing system - https://www.bigbluebutton.org/.
47
*
@@ -16,11 +19,12 @@
1619
* You should have received a copy of the GNU Lesser General Public License along
1720
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
1821
*/
19-
namespace BigBlueButton\Core;
20-
21-
class GuestPolicy
22-
{
22+
namespace BigBlueButton\Core;
23+
24+
final class GuestPolicy
25+
{
2326
public const ALWAYS_ACCEPT = 'ALWAYS_ACCEPT';
2427
public const ALWAYS_DENY = 'ALWAYS_DENY';
25-
public const ASK_MODERATOR = 'ASK_MODERATOR';
26-
}
28+
public const ASK_MODERATOR = 'ASK_MODERATOR';
29+
public const ALWAYS_ACCEPT_AUTH = 'ALWAYS_ACCEPT_AUTH';
30+
}

src/Core/MeetingLayout.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
/**
36
* BigBlueButton open source conferencing system - https://www.bigbluebutton.org/.
47
*
@@ -18,7 +21,7 @@
1821
*/
1922
namespace BigBlueButton\Core;
2023

21-
class MeetingLayout
24+
final class MeetingLayout
2225
{
2326
public const CUSTOM_LAYOUT = 'CUSTOM_LAYOUT';
2427
public const SMART_LAYOUT = 'SMART_LAYOUT';

src/Parameters/CreateMeetingParameters.php

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
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/>.
1818
*/
19-
2019
namespace BigBlueButton\Parameters;
2120

21+
use BigBlueButton\Core\GuestPolicy;
22+
use BigBlueButton\Core\MeetingLayout;
23+
2224
/**
2325
* @method string getName()
2426
* @method $this setName(string $name)
@@ -122,15 +124,39 @@
122124
*/
123125
class CreateMeetingParameters extends MetaParameters
124126
{
125-
public const ALWAYS_ACCEPT = 'ALWAYS_ACCEPT';
126-
public const ALWAYS_DENY = 'ALWAYS_DENY';
127-
public const ASK_MODERATOR = 'ASK_MODERATOR';
128-
public const ALWAYS_ACCEPT_AUTH = 'ALWAYS_ACCEPT_AUTH';
127+
/**
128+
* @deprecated Use GuestPolicy::ALWAYS_ACCEPT instead.
129+
*/
130+
public const ALWAYS_ACCEPT = GuestPolicy::ALWAYS_ACCEPT;
131+
/**
132+
* @deprecated Use GuestPolicy::ALWAYS_DENY instead.
133+
*/
134+
public const ALWAYS_DENY = GuestPolicy::ALWAYS_DENY;
135+
/**
136+
* @deprecated Use GuestPolicy::ASK_MODERATOR instead.
137+
*/
138+
public const ASK_MODERATOR = GuestPolicy::ASK_MODERATOR;
139+
/**
140+
* @deprecated Use GuestPolicy::ALWAYS_ACCEPT_AUTH instead.
141+
*/
142+
public const ALWAYS_ACCEPT_AUTH = GuestPolicy::ALWAYS_ACCEPT_AUTH;
129143

130-
const CUSTOM_LAYOUT = 'CUSTOM_LAYOUT';
131-
const SMART_LAYOUT = 'SMART_LAYOUT';
132-
const PRESENTATION_FOCUS = 'PRESENTATION_FOCUS';
133-
const VIDEO_FOCUS = 'VIDEO_FOCUS';
144+
/**
145+
* @deprecated Use MeetingLayout::CUSTOM_LAYOUT instead.
146+
*/
147+
public const CUSTOM_LAYOUT = MeetingLayout::CUSTOM_LAYOUT;
148+
/**
149+
* @deprecated Use MeetingLayout::SMART_LAYOUT instead.
150+
*/
151+
public const SMART_LAYOUT = MeetingLayout::SMART_LAYOUT;
152+
/**
153+
* @deprecated Use MeetingLayout::PRESENTATION_FOCUS instead.
154+
*/
155+
public const PRESENTATION_FOCUS = MeetingLayout::PRESENTATION_FOCUS;
156+
/**
157+
* @deprecated Use MeetingLayout::VIDEO_FOCUS instead.
158+
*/
159+
public const VIDEO_FOCUS = MeetingLayout::VIDEO_FOCUS;
134160

135161
/**
136162
* @var string
@@ -325,7 +351,7 @@ class CreateMeetingParameters extends MetaParameters
325351
/**
326352
* @var string
327353
*/
328-
protected $guestPolicy = self::ALWAYS_ACCEPT;
354+
protected $guestPolicy = GuestPolicy::ALWAYS_ACCEPT;
329355

330356
/**
331357
* @var bool
@@ -604,15 +630,15 @@ public function setParentMeetingId(string $parentMeetingID)
604630
*/
605631
public function isGuestPolicyAlwaysDeny()
606632
{
607-
return $this->guestPolicy === self::ALWAYS_DENY;
633+
return $this->guestPolicy === GuestPolicy::ALWAYS_DENY;
608634
}
609635

610636
/**
611637
* @return CreateMeetingParameters
612638
*/
613639
public function setGuestPolicyAlwaysDeny()
614640
{
615-
$this->guestPolicy = self::ALWAYS_DENY;
641+
$this->guestPolicy = GuestPolicy::ALWAYS_DENY;
616642

617643
return $this;
618644
}
@@ -622,7 +648,7 @@ public function setGuestPolicyAlwaysDeny()
622648
*/
623649
public function isGuestPolicyAskModerator()
624650
{
625-
return $this->guestPolicy === self::ASK_MODERATOR;
651+
return $this->guestPolicy === GuestPolicy::ASK_MODERATOR;
626652
}
627653

628654
/**
@@ -631,7 +657,7 @@ public function isGuestPolicyAskModerator()
631657
*/
632658
public function setGuestPolicyAskModerator()
633659
{
634-
$this->guestPolicy = self::ASK_MODERATOR;
660+
$this->guestPolicy = GuestPolicy::ASK_MODERATOR;
635661

636662
return $this;
637663
}
@@ -641,15 +667,16 @@ public function setGuestPolicyAskModerator()
641667
*/
642668
public function isGuestPolicyAlwaysAcceptAuth()
643669
{
644-
return $this->guestPolicy === self::ALWAYS_ACCEPT_AUTH;
670+
return $this->guestPolicy === GuestPolicy::ALWAYS_ACCEPT_AUTH;
645671
}
646672

647673
/**
648674
* Ask moderator on join of guests is allowed to enter the meeting, user are allowed to join directly
675+
* @return CreateMeetingParameters
649676
*/
650677
public function setGuestPolicyAlwaysAcceptAuth()
651678
{
652-
$this->guestPolicy = self::ALWAYS_ACCEPT_AUTH;
679+
$this->guestPolicy = GuestPolicy::ALWAYS_ACCEPT_AUTH;
653680

654681
return $this;
655682
}

src/Responses/ApiVersionResponse.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
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/>.
1818
*/
19-
2019
namespace BigBlueButton\Responses;
2120

2221
/**

src/Responses/GetRecordingTextTracksResponse.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
/**
2424
* Class GetRecordingTextTracksResponse
25-
*
2625
* @package BigBlueButton\Responses
2726
*/
2827
class GetRecordingTextTracksResponse extends BaseResponseAsJson

tests/TestCase.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
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/>.
1818
*/
19-
2019
namespace BigBlueButton;
2120

2221
use BigBlueButton\Core\GuestPolicy;
22+
use BigBlueButton\Core\MeetingLayout;
2323
use BigBlueButton\Parameters\CreateMeetingParameters as CreateMeetingParameters;
2424
use BigBlueButton\Parameters\EndMeetingParameters;
2525
use BigBlueButton\Parameters\JoinMeetingParameters as JoinMeetingParameters;
@@ -108,10 +108,10 @@ protected function generateCreateParams()
108108
'endWhenNoModerator' => $this->faker->boolean(50),
109109
'endWhenNoModeratorDelayInMinutes' => $this->faker->numberBetween(1, 100),
110110
'meetingLayout' => $this->faker->randomElement([
111-
CreateMeetingParameters::CUSTOM_LAYOUT,
112-
CreateMeetingParameters::SMART_LAYOUT,
113-
CreateMeetingParameters::PRESENTATION_FOCUS,
114-
CreateMeetingParameters::VIDEO_FOCUS
111+
MeetingLayout::CUSTOM_LAYOUT,
112+
MeetingLayout::SMART_LAYOUT,
113+
MeetingLayout::PRESENTATION_FOCUS,
114+
MeetingLayout::VIDEO_FOCUS
115115
]),
116116
'learningDashboardEnabled' => $this->faker->boolean(50),
117117
'learningDashboardCleanupDelayInMinutes' => $this->faker->numberBetween(1, 100),

tests/functional/AbstractBigBlueButtonFunctionalTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function testApiVersion()
105105
/**
106106
* Test create meeting URL
107107
*/
108-
public function testCreateMeetingUrl()
108+
public function testCreateMeetingUrl(): void
109109
{
110110
$params = $this->generateCreateParams();
111111
$url = $this->bbb->getCreateMeetingUrl($this->getCreateMock($params));
@@ -194,7 +194,7 @@ public function testCreateMeetingWithMultiDocument()
194194
/**
195195
* Test create join meeting URL
196196
*/
197-
public function testCreateJoinMeetingUrl()
197+
public function testCreateJoinMeetingUrl(): void
198198
{
199199
$joinMeetingParams = $this->generateJoinMeetingParams();
200200
$joinMeetingMock = $this->getJoinMeetingMock($joinMeetingParams);
@@ -236,7 +236,7 @@ public function testJoinMeeting()
236236
/**
237237
* Test generate end meeting URL
238238
*/
239-
public function testCreateEndMeetingUrl()
239+
public function testCreateEndMeetingUrl(): void
240240
{
241241
$params = $this->generateEndMeetingParams();
242242
$url = $this->bbb->getEndMeetingURL($this->getEndMeetingMock($params));
@@ -278,7 +278,7 @@ public function testIsMeetingRunning()
278278

279279
/* Get Meetings */
280280

281-
public function testGetMeetingsUrl()
281+
public function testGetMeetingsUrl(): void
282282
{
283283
$url = $this->bbb->getMeetingsUrl();
284284
$this->assertStringContainsString(ApiMethod::GET_MEETINGS, $url);
@@ -292,7 +292,7 @@ public function testGetMeetings()
292292

293293
/* Get meeting info */
294294

295-
public function testGetMeetingInfoUrl()
295+
public function testGetMeetingInfoUrl(): void
296296
{
297297
$meeting = $this->createRealMeeting($this->bbb);
298298

@@ -309,7 +309,7 @@ public function testGetMeetingInfo()
309309
$this->assertTrue($result->success());
310310
}
311311

312-
public function testGetRecordingsUrl()
312+
public function testGetRecordingsUrl(): void
313313
{
314314
$url = $this->bbb->getRecordingsUrl(new GetRecordingsParameters());
315315
$this->assertStringContainsString(ApiMethod::GET_RECORDINGS, $url);
@@ -322,7 +322,7 @@ public function testGetRecordings()
322322
$this->assertTrue($result->success());
323323
}
324324

325-
public function testPublishRecordingsUrl()
325+
public function testPublishRecordingsUrl(): void
326326
{
327327
$url = $this->bbb->getPublishRecordingsUrl(new PublishRecordingsParameters($this->faker->sha1, true));
328328
$this->assertStringContainsString(ApiMethod::PUBLISH_RECORDINGS, $url);
@@ -335,7 +335,7 @@ public function testPublishRecordings()
335335
$this->assertTrue($result->failed());
336336
}
337337

338-
public function testDeleteRecordingsUrl()
338+
public function testDeleteRecordingsUrl(): void
339339
{
340340
$url = $this->bbb->getDeleteRecordingsUrl(new DeleteRecordingsParameters($this->faker->sha1));
341341
$this->assertStringContainsString(ApiMethod::DELETE_RECORDINGS, $url);
@@ -348,7 +348,7 @@ public function testDeleteRecordings()
348348
$this->assertTrue($result->failed());
349349
}
350350

351-
public function testUpdateRecordingsUrl()
351+
public function testUpdateRecordingsUrl(): void
352352
{
353353
$params = $this->generateUpdateRecordingsParams();
354354
$url = $this->bbb->getUpdateRecordingsUrl($this->getUpdateRecordingsParamsMock($params));

0 commit comments

Comments
 (0)