1 | <?php |
||
48 | class BigBlueButton |
||
49 | { |
||
50 | private $securitySalt; |
||
51 | private $bbbServerBaseUrl; |
||
52 | private $urlBuilder; |
||
53 | |||
54 | public function __construct() |
||
|
|||
55 | { |
||
56 | $this->securitySalt = $_SERVER['BBB_SECURITY_SALT']; |
||
57 | $this->bbbServerBaseUrl = $_SERVER['BBB_SERVER_BASE_URL']; |
||
58 | $this->urlBuilder = new UrlBuilder($this->securitySalt, $this->bbbServerBaseUrl); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return ApiVersionResponse |
||
63 | * |
||
64 | * @throws \RuntimeException |
||
65 | */ |
||
66 | public function getApiVersion() |
||
67 | { |
||
68 | return new ApiVersionResponse($this->processXmlResponse($this->urlBuilder->buildUrl())); |
||
69 | } |
||
70 | |||
71 | /* __________________ BBB ADMINISTRATION METHODS _________________ */ |
||
72 | /* The methods in the following section support the following categories of the BBB API: |
||
73 | -- create |
||
74 | -- getDefaultConfigXML |
||
75 | -- join |
||
76 | -- end |
||
77 | */ |
||
78 | |||
79 | /** |
||
80 | * @param CreateMeetingParameters $createMeetingParams |
||
81 | * @return string |
||
82 | */ |
||
83 | public function getCreateMeetingUrl($createMeetingParams) |
||
87 | |||
88 | /** |
||
89 | * @param CreateMeetingParameters $createMeetingParams |
||
90 | * @return CreateMeetingResponse |
||
91 | * @throws \RuntimeException |
||
92 | */ |
||
93 | public function createMeeting($createMeetingParams) |
||
99 | |||
100 | /** |
||
101 | * @return string |
||
102 | */ |
||
103 | public function getDefaultConfigXMLUrl() |
||
107 | |||
108 | /** |
||
109 | * @return GetDefaultConfigXMLResponse |
||
110 | * @throws \RuntimeException |
||
111 | */ |
||
112 | public function getDefaultConfigXML() |
||
118 | |||
119 | /** |
||
120 | * @param $joinMeetingParams JoinMeetingParameters |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | public function getJoinMeetingURL($joinMeetingParams) |
||
128 | |||
129 | /** |
||
130 | * @param $joinMeetingParams JoinMeetingParameters |
||
131 | * |
||
132 | * @return JoinMeetingResponse |
||
133 | * @throws \RuntimeException |
||
134 | */ |
||
135 | public function joinMeeting($joinMeetingParams) |
||
141 | |||
142 | /** |
||
143 | * @param $endParams EndMeetingParameters |
||
144 | * |
||
145 | * @return string |
||
146 | */ |
||
147 | public function getEndMeetingURL($endParams) |
||
151 | |||
152 | /** |
||
153 | * @param $endParams EndMeetingParameters |
||
154 | * |
||
155 | * @return EndMeetingResponse |
||
156 | * @throws \RuntimeException |
||
157 | * */ |
||
158 | public function endMeeting($endParams) |
||
164 | |||
165 | /* __________________ BBB MONITORING METHODS _________________ */ |
||
166 | /* The methods in the following section support the following categories of the BBB API: |
||
167 | -- isMeetingRunning |
||
168 | -- getMeetings |
||
169 | -- getMeetingInfo |
||
170 | */ |
||
171 | |||
172 | /** |
||
173 | * @param $meetingParams IsMeetingRunningParameters |
||
174 | * @return string |
||
175 | */ |
||
176 | public function getIsMeetingRunningUrl($meetingParams) |
||
180 | |||
181 | /** |
||
182 | * @param $meetingParams |
||
183 | * @return IsMeetingRunningResponse |
||
184 | * @throws \RuntimeException |
||
185 | */ |
||
186 | public function isMeetingRunning($meetingParams) |
||
192 | |||
193 | /** |
||
194 | * @return string |
||
195 | */ |
||
196 | public function getMeetingsUrl() |
||
200 | |||
201 | /** |
||
202 | * @return GetMeetingsResponse |
||
203 | * @throws \RuntimeException |
||
204 | */ |
||
205 | public function getMeetings() |
||
211 | |||
212 | /** |
||
213 | * @param $meetingParams GetMeetingInfoParameters |
||
214 | * @return string |
||
215 | */ |
||
216 | public function getMeetingInfoUrl($meetingParams) |
||
220 | |||
221 | /** |
||
222 | * @param $meetingParams GetMeetingInfoParameters |
||
223 | * @return GetMeetingInfoResponse |
||
224 | * @throws \RuntimeException |
||
225 | */ |
||
226 | public function getMeetingInfo($meetingParams) |
||
232 | |||
233 | /* __________________ BBB RECORDING METHODS _________________ */ |
||
234 | /* The methods in the following section support the following categories of the BBB API: |
||
235 | -- getRecordings |
||
236 | -- publishRecordings |
||
237 | -- deleteRecordings |
||
238 | */ |
||
239 | |||
240 | /** |
||
241 | * @param $recordingsParams GetRecordingsParameters |
||
242 | * @return string |
||
243 | */ |
||
244 | public function getRecordingsUrl($recordingsParams) |
||
248 | |||
249 | /** |
||
250 | * @param $recordingParams |
||
251 | * @return GetRecordingsResponse |
||
252 | * @throws \RuntimeException |
||
253 | */ |
||
254 | public function getRecordings($recordingParams) |
||
260 | |||
261 | /** |
||
262 | * @param $recordingParams PublishRecordingsParameters |
||
263 | * @return string |
||
264 | */ |
||
265 | public function getPublishRecordingsUrl($recordingParams) |
||
269 | |||
270 | /** |
||
271 | * @param $recordingParams PublishRecordingsParameters |
||
272 | * @return PublishRecordingsResponse |
||
273 | * @throws \RuntimeException |
||
274 | */ |
||
275 | public function publishRecordings($recordingParams) |
||
281 | |||
282 | /** |
||
283 | * @param $recordingParams DeleteRecordingsParameters |
||
284 | * @return string |
||
285 | */ |
||
286 | public function deleteRecordingsUrl($recordingParams) |
||
290 | |||
291 | /** |
||
292 | * @param $recordingParams |
||
293 | * @return DeleteRecordingsResponse |
||
294 | * @throws \RuntimeException |
||
295 | */ |
||
296 | public function deleteRecordings($recordingParams) |
||
302 | |||
303 | /* ____________________ INTERNAL CLASS METHODS ___________________ */ |
||
304 | |||
305 | /** |
||
306 | * A private utility method used by other public methods to process XML responses. |
||
307 | * |
||
308 | * @param $url |
||
309 | * @param string $xml |
||
310 | * @return SimpleXMLElement |
||
311 | * @throws \RuntimeException |
||
312 | */ |
||
313 | private function processXmlResponse($url, $xml = '') |
||
348 | } |
||
349 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: