Skip to content

Commit ae1091d

Browse files
authored
Merge branch 'master' into add-parameter-typehints
2 parents 7ec4c80 + adc30ee commit ae1091d

31 files changed

Lines changed: 511 additions & 137 deletions

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.gitattributes export-ignore
2+
.gitignore export-ignore
3+
/.github export-ignore
4+
codeception.yml export-ignore
5+
.php_cs export-ignore
6+
phpunit.xml.dist export-ignore
7+
psalm.xml export-ignore
8+
/tests export-ignore

.github/workflows/ci.yml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,33 @@ on:
55
pull_request:
66

77
jobs:
8+
PHP_Lowest:
9+
name: PHP wth lowest dependencies
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
php-versions: ['7.2']
15+
experimental: [false]
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
- name: Setup PHP, with composer and extensions
21+
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
22+
with:
23+
php-version: ${{ matrix.php-versions }}
24+
extensions: bcmath, ctype, fileinfo, json, mbstring, dom, ldap, pdo, tokenizer, xml, mysql, sqlite
25+
coverage: xdebug
26+
- name: Downgrade phpunit for php7.2
27+
run: composer update phpunit/phpunit -W
28+
- name: Update to lowest php dependencies
29+
run: composer update --prefer-lowest
30+
- name: Install php dependencies
31+
run: composer install --dev --no-interaction
32+
- name: Execute tests without coverage
33+
run: vendor/bin/phpunit --testsuite="BigBlueButton unit test suite,BigBlueButton integration test suite"
34+
835
PHP:
936
name: PHP ${{ matrix.php-versions }}
1037
runs-on: ubuntu-latest
@@ -39,27 +66,13 @@ jobs:
3966
if: ${{ !matrix.experimental }}
4067
run: |
4168
mkdir -p build/logs
42-
vendor/bin/phpunit --coverage-clover=build/logs/coverage.xml --testsuite="BigBlueButton test suite"
69+
vendor/bin/phpunit --coverage-clover=build/logs/coverage.xml --testsuite="BigBlueButton unit test suite,BigBlueButton integration test suite"
4370
- name: Execute tests without coverage
4471
if: ${{ matrix.experimental }}
4572
run: vendor/bin/phpunit --testsuite="BigBlueButton test suite"
4673
continue-on-error: true
4774
- name: Coveralls
4875
env:
49-
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
76+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5077
if: ${{ matrix.php-versions == '7.2' && env.COVERALLS_REPO_TOKEN != null }}
5178
run: vendor/bin/php-coveralls --coverage_clover=build/logs/coverage.xml -v
52-
53-
54-
HHVM:
55-
name: HHVM
56-
runs-on: ubuntu-latest
57-
steps:
58-
- uses: actions/checkout@v2
59-
- uses: azjezz/setup-hhvm@v1
60-
with:
61-
version: 'latest'
62-
- run: composer install --dev --no-interaction
63-
continue-on-error: true
64-
- run: hhvm vendor/bin/phpunit
65-
continue-on-error: true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ composer.phar
1010
.php_cs.cache
1111
cghooks.lock
1212

13+
# PHPUnit reports (for convenience when working locally)
14+
reports
15+
16+
# PHPUnit result cache
1317
.phpunit.result.cache
1418

1519
# Local environment variables

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# :tada: Best BigBlueButton API for PHP
22

33
The unofficial and easiest to use **BigBlueButton API for PHP**, makes easy for
4-
developers to use [BigBlueButton API] v2.2 for **PHP 7.2+**.
4+
developers to use [BigBlueButton API] v2.2+ for **PHP 7.2+**.
55

66
![Build Status](https://github.com/littleredbutton/bigbluebutton-api-php/workflows/CI/badge.svg)
77
[![Coverage Status](https://coveralls.io/repos/github/littleredbutton/bigbluebutton-api-php/badge.svg?branch=master)](https://coveralls.io/github/littleredbutton/bigbluebutton-api-php?branch=master)
8-
![PHP from Travis config](https://img.shields.io/travis/php-v/littleredbutton/bigbluebutton-api-php.svg)
8+
![PHP from Packagist](https://img.shields.io/packagist/php-v/littleredbutton/bigbluebutton-api-php)
99
<!-- [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/littleredbutton/bigbluebutton-api-php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/littleredbutton/bigbluebutton-api-php/?branch=master) -->
1010

1111
**This API uses BigBlueButton and is not endorsed or certified by BigBlueButton
@@ -91,6 +91,8 @@ $bbb = new BigBlueButton($apiUrl, $apiSecret);
9191

9292
If you didn't use composer before, make sure that you include `vendor/autoload.php`.
9393

94+
In general the usage is closly related to the official [API description](https://docs.bigbluebutton.org/dev/api.html). This means to create a room, you have to create a `CreateMeetingParameters` object and set all required parameters via the related setter method. This means to set the `attendeePW`, you have to call `setAttendeePW` and so on.
95+
9496
#### Test if API url and secret are valid
9597
```php
9698
use BigBlueButton\Parameters\IsMeetingRunningParameters;
@@ -126,8 +128,8 @@ $version = $bbb->getApiVersion()->getVersion();
126128
use BigBlueButton\Parameters\CreateMeetingParameters;
127129

128130
$createMeetingParams = new CreateMeetingParameters($meetingID, $meetingName);
129-
$createMeetingParams->setAttendeePassword($attendee_password);
130-
$createMeetingParams->setModeratorPassword($moderator_password);
131+
$createMeetingParams->setAttendeePW($attendee_password);
132+
$createMeetingParams->setModeratorPW($moderator_password);
131133

132134
$createMeetingResponse = $bbb->createMeeting($createMeetingParams);
133135

@@ -157,7 +159,7 @@ $createMeetingParams->setGuestPolicyAlwaysAcceptAuth();
157159
use BigBlueButton\Parameters\JoinMeetingParameters;
158160

159161
$joinMeetingParams = new JoinMeetingParameters($room->uid, $displayname, $password);
160-
$joinMeetingParams->setCreationTime($createMeetingResponse->getCreationTime());
162+
$joinMeetingParams->setCreateTime($createMeetingResponse->getCreationTime());
161163
$joinMeetingParams->setJoinViaHtml5(true);
162164
$joinMeetingParams->setRedirect(true);
163165

@@ -253,7 +255,7 @@ if ($response->failed()) {
253255
use BigBlueButton\Parameters\GetRecordingsParameters;
254256

255257
$recordingParams = new GetRecordingsParameters();
256-
$recordingParams->setRecordId($recordId); // omit to get a list of all recordings
258+
$recordingParams->setRecordID($recordId); // omit to get a list of all recordings
257259
$recordingParams->setState('any');
258260

259261
$response = $bbb->getRecordings($recordingParams);
@@ -496,7 +498,7 @@ The integration requires additional setup as there are using a real BigBlueButto
496498
You need to create a `.env.local` file to configure which server to use and the proper credentials:
497499

498500
```shell
499-
echo "BBB_SERVER_BASE_URL=https://bbb.example/bigbluebutton/" > env.local
501+
echo "BBB_SERVER_BASE_URL=https://bbb.example/bigbluebutton/" > .env.local
500502
echo "BBB_SECRET=S3cr3t" >> .env.local
501503
```
502504

composer.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,15 @@
9494
"BigBlueButton\\": ["src", "tests/integration"]
9595
}
9696
},
97+
"autoload-dev": {
98+
"psr-4": {
99+
"BigBlueButton\\Tests\\Functional\\": ["tests/functional"]
100+
}
101+
},
97102
"scripts": {
98-
"test": "vendor/bin/phpunit",
99-
"test-integration": "vendor/bin/phpunit --testsuite=\"BigBlueButton integration test suite\" --exclude-group=integration-legacy",
103+
"test": "vendor/bin/phpunit --testsuite=\"BigBlueButton unit test suite\"",
104+
"test-integration": "vendor/bin/phpunit --testsuite=\"BigBlueButton integration test suite\"",
105+
"test-functional": "vendor/bin/phpunit --testsuite=\"BigBlueButton functional test suite\" --exclude-group=functional-legacy",
100106
"cs-fix": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
101107
"cs-test": "vendor/bin/php-cs-fixer fix --dry-run --allow-risky=yes",
102108
"psalm": "psalm --threads=1",
@@ -111,7 +117,7 @@
111117
"vendor/bin/php-cs-fixer fix --dry-run --allow-risky=yes"
112118
],
113119
"pre-push": [
114-
"vendor/bin/phpunit --testsuite=\"BigBlueButton test suite\"",
120+
"vendor/bin/phpunit --testsuite=\"BigBlueButton unit test suite,BigBlueButton integration test suite\"",
115121
"vendor/bin/psalm --threads=1"
116122
],
117123
"post-merge": "composer install",

phpunit-integration.xml.dist

Lines changed: 0 additions & 26 deletions
This file was deleted.

phpunit.xml.dist

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@
1818
</filter>
1919

2020
<testsuites>
21-
<testsuite name="BigBlueButton test suite">
21+
<testsuite name="BigBlueButton unit test suite">
2222
<directory>./tests/unit/</directory>
2323
</testsuite>
2424
<testsuite name="BigBlueButton integration test suite">
2525
<directory>./tests/integration/</directory>
2626
</testsuite>
27+
<testsuite name="BigBlueButton functional test suite">
28+
<directory>./tests/functional/</directory>
29+
</testsuite>
2730
</testsuites>
2831

2932
</phpunit>

src/Core/Attendee.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Attendee
5858
/**
5959
* @var array
6060
*/
61-
private $customData;
61+
private $customData = [];
6262

6363
/**
6464
* @var string

src/Core/Meeting.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,36 @@ public function getAttendees()
375375
return $this->attendees;
376376
}
377377

378+
/**
379+
* Moderators of Meeting - Subset of Attendees
380+
* @return Attendee[]
381+
*/
382+
public function getModerators(): array
383+
{
384+
$attendees = $this->getAttendees();
385+
386+
$moderators = array_filter($attendees, function ($attendee) {
387+
return $attendee->getRole() === 'MODERATOR';
388+
});
389+
390+
return array_values($moderators);
391+
}
392+
393+
/**
394+
* Viewers of Meeting - Subset of Attendees
395+
* @return Attendee[]
396+
*/
397+
public function getViewers(): array
398+
{
399+
$attendees = $this->getAttendees();
400+
401+
$viewers = array_filter($attendees, function ($attendee) {
402+
return $attendee->getRole() === 'VIEWER';
403+
});
404+
405+
return array_values($viewers);
406+
}
407+
378408
/**
379409
* @return array
380410
*/

src/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransport.php

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
use BigBlueButton\Exceptions\NetworkException;
2424
use BigBlueButton\Exceptions\RuntimeException;
25-
use BigBlueButton\Http\SetCookie;
25+
use BigBlueButton\Http\Transport\Cookie;
2626
use BigBlueButton\Http\Transport\TransportInterface;
2727
use BigBlueButton\Http\Transport\TransportRequest;
2828
use BigBlueButton\Http\Transport\TransportResponse;
@@ -130,23 +130,8 @@ public function request(TransportRequest $request): TransportResponse
130130
throw new NetworkException('Bad response.', $psrResponse->getStatusCode());
131131
}
132132

133-
$jsessionCookie = null;
134-
135-
foreach ($psrResponse->getHeader('Set-Cookie') as $headerValue) {
136-
$cookie = SetCookie::fromString($headerValue);
137-
138-
if ($cookie->getName() === 'JSESSIONID') {
139-
$value = $cookie->getValue();
140-
141-
if ('' === $value) {
142-
break;
143-
}
144-
145-
$jsessionCookie = $value;
146-
147-
break;
148-
}
149-
}
133+
$headerValues = $psrResponse->getHeader('Set-Cookie');
134+
$jsessionCookie = Cookie::extractJsessionId($headerValues);
150135

151136
return new TransportResponse($psrResponse->getBody()->getContents(), $jsessionCookie);
152137
}

0 commit comments

Comments
 (0)