Skip to content

Commit a48a106

Browse files
authored
Merge pull request #189 from riadvice/master
2 parents 0d85cec + 9679f76 commit a48a106

39 files changed

+1206
-206
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ composer.lock
88
/nbproject
99

1010
# PHP CS Fixer cache file
11-
.php_cs.cache
11+
.php-cs-fixer.cache
12+
13+
.phpunit.result.cache

.php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
->setRiskyAllowed(true)
3232
->setRules([
3333
'@PhpCsFixer' => true,
34+
'@PHP74Migration' => true,
3435
'general_phpdoc_annotation_remove' => ['annotations' => ['expectedDeprecation']], // one should use PHPUnit built-in method instead
3536
'header_comment' => ['header' => $header],
3637
'concat_space' => ['spacing' => 'one'],

.scrutinizer.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
build:
2+
nodes:
3+
analysis:
4+
project_setup:
5+
override: true
6+
environment:
7+
php:
8+
version: 8.1
9+
compile_options: '--with-openssl --with-curl --enable-mbstring --enable-mbregex --enable-bcmath --with-mhash --with-xmlrpc --enable-opcache --enable-intl --with-pear --enable-fpm --with-zlib-dir --enable-inline-optimization --with-bz2 --with-zlib'
10+
tests:
11+
override:
12+
- php-scrutinizer-run --enable-security-analysis
13+
filter:
14+
excluded_paths:
15+
- 'tests/*'
16+
checks:
17+
php:
18+
uppercase_constants: true
19+
remove_extra_empty_lines: true
20+
function_in_camel_caps: true
21+
avoid_fixme_comments: true
22+
avoid_todo_comments: true
23+
24+
coding_style:
25+
php:
26+
indentation:
27+
general:
28+
size: 1
29+
spaces:
30+
around_operators:
31+
concatenation: false

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ The official and easy to use **BigBlueButton API for PHP**, makes easy for devel
99
![PHP from Travis config](https://img.shields.io/travis/php-v/bigbluebutton/bigbluebutton-api-php.svg)
1010
[![Downloads](https://img.shields.io/packagist/dt/bigbluebutton/bigbluebutton-api-php.svg?style=flat-square)](https://packagist.org/packages/bigbluebutton/bigbluebutton-api-php)
1111

12-
[![Build Status](https://travis-ci.org/bigbluebutton/bigbluebutton-api-php.svg?branch=master)](https://travis-ci.org/bigbluebutton/bigbluebutton-api-php)
13-
[![Coverage Status](https://coveralls.io/repos/github/bigbluebutton/bigbluebutton-api-php/badge.svg?branch=master)](https://coveralls.io/github/bigbluebutton/bigbluebutton-api-php?branch=master)
12+
[![Build Status](https://scrutinizer-ci.com/g/bigbluebutton/bigbluebutton-api-php/badges/build.png?b=master)](https://scrutinizer-ci.com/g/bigbluebutton/bigbluebutton-api-php/build-status/master)
13+
[![Code Coverage](https://scrutinizer-ci.com/g/bigbluebutton/bigbluebutton-api-php/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/bigbluebutton/bigbluebutton-api-php/?branch=master)
1414
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/bigbluebutton/bigbluebutton-api-php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/bigbluebutton/bigbluebutton-api-php/?branch=master)
1515

1616
[![@bigbluebutton on Twitter](https://img.shields.io/badge/twitter-%40bigbluebutton-blue.svg?style=flat)](https://twitter.com/bigbluebutton)
@@ -37,15 +37,15 @@ Bugs and feature request are tracked on [GitHub](https://github.com/bigbluebutto
3737
Make sure the code style configuration is applied by running PHPCS-Fixer.
3838

3939
```
40-
./vendor/bin/php-cs-fixer fix
40+
composer cs-fix
4141
```
4242

4343
### Running tests
4444

4545
For every implemented feature add unit tests and check all is green by running the command below.
4646

4747
```bash
48-
./vendor/bin/phpunit
48+
composer test
4949
```
5050

5151
To run a single test

composer.json

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,30 @@
2626
"php": ">=7.1",
2727
"ext-curl": "*",
2828
"ext-simplexml": "*",
29-
"ext-mbstring": "*"
29+
"ext-mbstring": "*",
30+
"marc-mabe/php-enum": "^4.7"
3031
},
3132
"require-dev": {
32-
"ext-mbstring": "*",
33-
"phpunit/phpunit": "^8.5",
33+
"phpunit/phpunit": "^9.5",
3434
"fakerphp/faker": "^1.17",
35-
"friendsofphp/php-cs-fixer": "^3.8.0",
36-
"squizlabs/php_codesniffer": "^3.7",
37-
"php-coveralls/php-coveralls": "^2.5.2"
35+
"friendsofphp/php-cs-fixer": "^3.9.2",
36+
"squizlabs/php_codesniffer": "^3.7.1",
37+
"phploc/phploc": "^7.0.2",
38+
"nunomaduro/phpinsights": "^v2.4.0",
39+
"bmitch/churn-php": "^1.7",
40+
"phpmetrics/phpmetrics": "^v2.8.1",
41+
"wapmorgan/php-deprecation-detector": "^2.0"
42+
},
43+
"scripts": {
44+
"test": "./vendor/bin/phpunit",
45+
"test-cov": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-html coverage",
46+
"cs-fix": "./vendor/bin/php-cs-fixer fix --allow-risky yes",
47+
"sniffer": "./vendor/bin/phpcs src/",
48+
"phploc": "./vendor/bin/phploc src/",
49+
"phpinsights": "./vendor/bin/phpinsights",
50+
"phpdd": "./vendor/bin/phpdd --target 7.4 src/",
51+
"phpmetrics": "./vendor/bin/phpmetrics --report-html=metrics src/",
52+
"churn": "./vendor/bin/churn run src/"
3853
},
3954
"options": {
4055
"symlink": false
@@ -43,5 +58,18 @@
4358
"psr-4": {
4459
"BigBlueButton\\": "src"
4560
}
61+
},
62+
"autoload-dev": {
63+
"psr-4": {
64+
"BigBlueButton\\": [
65+
"src",
66+
"tests"
67+
]
68+
}
69+
},
70+
"config": {
71+
"allow-plugins": {
72+
"dealerdirect/phpcodesniffer-composer-installer": true
73+
}
4674
}
4775
}

phpunit.xml.dist

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
4-
<phpunit backupGlobals="false"
5-
backupStaticAttributes="false"
6-
bootstrap="./tests/bootstrap.php"
7-
colors="true"
8-
convertErrorsToExceptions="true"
9-
convertNoticesToExceptions="true"
10-
convertWarningsToExceptions="true"
11-
processIsolation="false"
12-
stopOnFailure="false">
13-
14-
<php>
15-
<!-- Specify the value of your BigBlueButton secret -->
16-
<env name="BBB_SECRET" value="8cd8ef52e8e101574e400365b55e11a6"/>
17-
<!-- Specify the Server Base URL of your BigBlueButton -->
18-
<env name="BBB_SERVER_BASE_URL" value="https://test-install.blindsidenetworks.com/bigbluebutton/"/>
19-
</php>
20-
21-
<log type="coverage-html" target="./coverage"
22-
charset='UTF-8' yui='true'/>
23-
24-
<filter>
25-
<whitelist processUncoveredFilesFromWhitelist="true">
26-
<directory suffix=".php">./src/</directory>
27-
</whitelist>
28-
</filter>
29-
30-
<testsuites>
31-
<testsuite name="BigBlueButton test suit">
32-
<directory>./tests/</directory>
33-
</testsuite>
34-
</testsuites>
35-
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="./tests/bootstrap.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src/</directory>
6+
</include>
7+
</coverage>
8+
<php>
9+
<env name="XDEBUG_MODE" value="coverage"/>
10+
<!-- Specify the value of your BigBlueButton secret -->
11+
<env name="BBB_SECRET" value="8cd8ef52e8e101574e400365b55e11a6"/>
12+
<!-- Specify the Server Base URL of your BigBlueButton -->
13+
<env name="BBB_SERVER_BASE_URL" value="https://test-install.blindsidenetworks.com/bigbluebutton/"/>
14+
</php>
15+
<testsuites>
16+
<testsuite name="BigBlueButton test suite">
17+
<directory>./tests/</directory>
18+
</testsuite>
19+
</testsuites>
3620
</phpunit>

src/BigBlueButton.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use BigBlueButton\Parameters\GetRecordingsParameters;
3030
use BigBlueButton\Parameters\HooksCreateParameters;
3131
use BigBlueButton\Parameters\HooksDestroyParameters;
32+
use BigBlueButton\Parameters\InsertDocumentParameters;
3233
use BigBlueButton\Parameters\IsMeetingRunningParameters;
3334
use BigBlueButton\Parameters\JoinMeetingParameters;
3435
use BigBlueButton\Parameters\PublishRecordingsParameters;
@@ -95,6 +96,7 @@ public function getApiVersion()
9596
-- create
9697
-- join
9798
-- end
99+
-- insertDocument
98100
*/
99101

100102
/**
@@ -169,6 +171,30 @@ public function endMeeting($endParams)
169171
return new EndMeetingResponse($xml);
170172
}
171173

174+
/**
175+
* @param CreateMeetingParameters $createMeetingParams
176+
*
177+
* @return string
178+
*/
179+
public function getInsertDocumentUrl($createMeetingParams)
180+
{
181+
return $this->urlBuilder->buildUrl(ApiMethod::INSERT_DOCUMENT, $createMeetingParams->getHTTPQuery());
182+
}
183+
184+
/**
185+
* @param InsertDocumentParameters $insertDocumentParams
186+
*
187+
* @throws \RuntimeException
188+
*
189+
* @return InsertDocumentResponse
190+
*/
191+
public function insertDocument($insertDocumentParams)
192+
{
193+
$xml = $this->processXmlResponse($this->getInsertDocumentUrl($insertDocumentParams), $insertDocumentParams->getPresentationsAsXML());
194+
195+
return new CreateMeetingResponse($xml);
196+
}
197+
172198
// __________________ BBB MONITORING METHODS _________________
173199
/* The methods in the following section support the following categories of the BBB API:
174200
-- isMeetingRunning

src/Core/ApiMethod.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ abstract class ApiMethod
2424
{
2525
public const CREATE = 'create';
2626
public const JOIN = 'join';
27+
public const INSERT_DOCUMENT = 'insertDocument';
2728
public const ENTER = 'enter';
2829
public const END = 'end';
2930
public const IS_MEETING_RUNNING = 'isMeetingRunning';

src/Enum/Feature.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
/*
4+
* BigBlueButton open source conferencing system - https://www.bigbluebutton.org/.
5+
*
6+
* Copyright (c) 2016-2022 BigBlueButton Inc. and by respective authors (see below).
7+
*
8+
* This program is free software; you can redistribute it and/or modify it under the
9+
* terms of the GNU Lesser General Public License as published by the Free Software
10+
* Foundation; either version 3.0 of the License, or (at your option) any later
11+
* version.
12+
*
13+
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
14+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15+
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public License along
18+
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
21+
namespace BigBlueButton\Enum;
22+
23+
use MabeEnum\Enum;
24+
25+
class Feature extends Enum
26+
{
27+
public const BREAKOUT_ROOMS = 'breakoutRooms';
28+
public const CAPTIONS = 'captions';
29+
public const CHAT = 'chat';
30+
public const EXTERNAL_VIDEOS = 'externalVideos';
31+
public const LAYOUTS = 'layouts';
32+
public const LEARNING_DASHBOARD = 'learningDashboard';
33+
public const POLLS = 'polls';
34+
public const SCREENSHARE = 'screenshare';
35+
public const SHARED_NOTES = 'sharedNotes';
36+
public const VIRTUAL_BACKGROUNDS = 'virtualBackgrounds';
37+
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
1919
*/
2020

21-
namespace BigBlueButton\Core;
21+
namespace BigBlueButton\Enum;
2222

23-
class GuestPolicy
23+
use MabeEnum\Enum;
24+
25+
class GuestPolicy extends Enum
2426
{
2527
public const ALWAYS_ACCEPT = 'ALWAYS_ACCEPT';
2628
public const ALWAYS_DENY = 'ALWAYS_DENY';

0 commit comments

Comments
 (0)