Completed
Push — master ( 1d1df5...87b1fe )
by Jesus
07:01
created

bigbluebutton   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A action_url() 0 14 3
1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
17
/**
18
 * The mod_bigbluebuttonbn locallib/bigbluebutton.
19
 *
20
 * @author    Jesus Federico  (jesus [at] blindsidenetworks [dt] com)
21
 * @copyright 2017 - present Blindside Networks Inc
22
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
23
 */
24
25
namespace mod_bigbluebuttonbn\locallib;
26
27
defined('MOODLE_INTERNAL') || die();
28
29
require_once($CFG->dirroot . '/mod/bigbluebuttonbn/locallib.php');
30
31
class bigbluebutton {
32
33
    /**
34
     * @param string $action
35
     * @param array  $data
36
     * @param array  $metadata
37
     * @return string
38
     */
39
    public static function action_url($action = '', $data = array(), $metadata = array()) {
40
        $baseurl = \mod_bigbluebuttonbn\locallib\config::get('server_url').'api/'.$action.'?';
41
        $params = '';
42
43
        foreach ($data as $key => $value) {
44
            $params .= '&'.$key.'='.urlencode($value);
45
        }
46
47
        foreach ($metadata as $key => $value) {
48
            $params .= '&'.'meta_'.$key.'='.urlencode($value);
49
        }
50
51
        return $baseurl.$params.'&checksum='.sha1($action.$params.\mod_bigbluebuttonbn\locallib\config::get('shared_secret'));
52
    }
53
}
54