protected static function call($function, array $data = [], $allowpublic = false) {

        $token = registration::get_token() ?: 'publichub';
        if (!$allowpublic && $token === 'publichub') {
            // This will throw an exception.
            registration::require_registration();
        }

        return self::call_rest($token, $function, $data);
    }
protected static function call($function, array $data = [], $allowpublic = false) {

        $token = registration::get_token() ?: 'publichub';
        if (!$allowpublic && $token === 'publichub') {
            // This will throw an exception.
            registration::require_registration();
        }

        return self::call_rest($token, $function, $data);
    }
protected static function call ( $ function , array $ data = [ ] , $ allowpublic = false ) { $ token = registration :: get_token ( ) ? : 'publichub' ; if ( ! $ allowpublic && $ token === 'publichub' ) { // This will throw an exception. registration :: require_registration ( ) ; } return self :: call_rest ( $ token , $ function , $ data ) ; }
Calls moodle.net WS

@param string $function name of WS function
@param array $data parameters of WS function
@param bool $allowpublic allow request without moodle.net registration
@return mixed depends on the function
@throws moodle_exception
Calls moodle . net WS