<commit_before>// Specification: http://oauth.net/core/1.0/#anchor14
var SignatureBaseString = (function () {
    'use strict';

	// requestUrl: if the scheme is missing, http will be added automatically
    function SignatureBaseString(httpMethod, requestUrl, parameters) {
        this._httpMethod = httpMethod || '';
        this._requestUrl = requestUrl || '';
	    this._parameters = new ParametersLoader(parameters).get(); // Format: { 'key': ['value 1', 'value 2'] };
	    this._sortedKeys = [];
	    this._concatenatedParameters = '';
	    this._encoder = new Rfc3986();
    }

	SignatureBaseString.prototype = {
        _normalizeHttpMethod : function () {
            this._httpMethod = this._httpMethod.toUpperCase();
        },
        _normalizeRequestUrl : function () {
            // The following is to prevent js-url from loading the window.location
            if (!this._requestUrl) {
                return;
            }
            var scheme = url('protocol', this._requestUrl).toLowerCase(),
                authority = url('hostname', this._requestUrl).toLocaleLowerCase(),
                port = url('port', this._requestUrl),
                path = url('path', this._requestUrl);
            if (this._requestUrl.toLowerCase().indexOf(scheme) != 0) {
                scheme = 'http';
            }
            if ((port == 80 && scheme == 'http')
                || (port == 443 && scheme == 'https'))
            {
                    port = '';
            }
            this._requestUrl =
                (scheme ? scheme + '://' : '')
                + authority
                + (port ? ':' + port : '')
                + path;
        },
        _sortParameters : function () {
            var key;
            this._sortedKeys = [];
            for (key in this._parameters) {
                this._sortedKeys.push(key);
            }
            this._sortedKeys.sort();
        },
        _normalizeParameters : function () {

        },
        _concatenateParameters : function () {
            var i;
            this._concatenatedParameters = this._sortedKeys.length == 0 ? '&' : '';
            for (i = 0; i < this._sortedKeys.length; i++) {
                this._concatenatedParameters += this._getConcatenatedParameter(this._sortedKeys[i]);
            }
        },
        _getConcatenatedParameter : function (key) {
            var i,
                parameters = this._parameters[key],
                concatenatedParameters = '';
            parameters.sort();
            for (i = 0; i < parameters.length; i++) {
                concatenatedParameters +=
	                '&' + this._encoder.encode(key) +
		            '=' + this._encoder.encode(parameters[i]);
            }
            return concatenatedParameters;
        },
        _concatenateRequestElements : function () {
            // HTTP_METHOD + request url + parameters
            return this._httpMethod + '&' + this._requestUrl + this._concatenatedParameters;
        },
        generate : function () {
            this._normalizeHttpMethod();
            this._normalizeRequestUrl();
            this._sortParameters();
            this._normalizeParameters();
            this._concatenateParameters();
            return this._concatenateRequestElements();
        }
    };
<commit_msg>Some more renaming<commit_after>// Specification: http://oauth.net/core/1.0/#anchor14
var SignatureBaseString = (function () {
    'use strict';

	// requestUrl: if the scheme is missing, http will be added automatically
    function SignatureBaseString(httpMethod, url, parameters) {
        this._httpMethod = httpMethod || '';
        this._url = url || '';
	    this._parameters = new ParametersLoader(parameters).get(); // Format: { 'key': ['value 1', 'value 2'] };

	    this._sortedKeys = [];
	    this._concatenatedParameters = '';
	    this._rfc3986 = new Rfc3986();

    }

	SignatureBaseString.prototype = {
        _normalizeHttpMethod : function () {
            this._httpMethod = this._httpMethod.toUpperCase();
        },
        _normalizeRequestUrl : function () {
            // The following is to prevent js-url from loading the window.location
            if (!this._url) {
                return;
            }
            var scheme = url('protocol', this._url).toLowerCase(),
                authority = url('hostname', this._url).toLocaleLowerCase(),
                port = url('port', this._url),
                path = url('path', this._url);
            if (this._url.toLowerCase().indexOf(scheme) != 0) {
                scheme = 'http';
            }
            if ((port == 80 && scheme == 'http')
                || (port == 443 && scheme == 'https'))
            {
                    port = '';
            }
            this._url =
                (scheme ? scheme + '://' : '')
                + authority
                + (port ? ':' + port : '')
                + path;
        },
        _sortParameters : function () {
            var key;
            this._sortedKeys = [];
            for (key in this._parameters) {
                this._sortedKeys.push(key);
            }
            this._sortedKeys.sort();
        },
        _normalizeParameters : function () {

        },
        _concatenateParameters : function () {
            var i;
            this._concatenatedParameters = this._sortedKeys.length == 0 ? '&' : '';
            for (i = 0; i < this._sortedKeys.length; i++) {
                this._concatenatedParameters += this._getConcatenatedParameter(this._sortedKeys[i]);
            }
        },
        _getConcatenatedParameter : function (key) {
            var i,
                parameters = this._parameters[key],
                concatenatedParameters = '';
            parameters.sort();
            for (i = 0; i < parameters.length; i++) {
                concatenatedParameters +=
	                '&' + this._rfc3986.encode(key) +
		            '=' + this._rfc3986.encode(parameters[i]);
            }
            return concatenatedParameters;
        },
        _concatenateRequestElements : function () {
            // HTTP_METHOD + request url + parameters
            return this._httpMethod + '&' + this._url + this._concatenatedParameters;
        },
        generate : function () {
            this._normalizeHttpMethod();
            this._normalizeRequestUrl();
            this._sortParameters();
            this._normalizeParameters();
            this._concatenateParameters();
            return this._concatenateRequestElements();
        }
    };

{'fraction_non_alphanumeric': 0.12599145820622332, 'fraction_numerical': 0.00762660158633313, 'mean_word_length': 1.6492929292929293, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6500081', 'n_tokens_mistral': 1718, 'n_tokens_neox': 1635, 'n_words': 328}