<commit_before>/**
 * packagist-feed v0.5.0
 * https://github.com/htmldriven/packagist-feed
 *
 * Copyright (c) 2016 <NAME>, HTMLDriven
 * MIT License
 * http://opensource.org/licenses/MIT
 */

var Packagist = (function (document, undefined) {
    'use strict';

    var obj = {};

    var methods = {
        sendRequest: function (url, success, error) {
            var request = new XMLHttpRequest();
            request.open('GET', url);

            request.setRequestHeader('Accept', 'application/json');

            request.onreadystatechange = function () {
                if (request.readyState === 4) {
                    if (request.status >= 200 && request.status < 300) {
                        var data = JSON.parse(request.responseText);
                        success(data);
                    } else {
                        error('request for ' + url + ' yielded status ' + request.status);
                    }
                }
            };

            request.onerror = function () {
                error('An error occurred connecting to ' + url);
            };
            request.send();
        },
        getElement: function (selector) {
            return selector.charAt(0) === '#' ? document.getElementById(selector.substring(1)) : document.getElementsByClassName(selector.substring(1));
        },
        getAsyncPackageInfo: function (packageName, success) {
            var packageUrl = 'https://packagist.org/packages/' + packageName + '.json';
            this.sendRequest(
                packageUrl,
                function (data) {
                    var packageInfo = data.package || null;
                    var gitHubApiUrl = packageInfo.repository.replace('https://github.com', 'https://api.github.com/repos');

                    methods.sendRequest(
                        gitHubApiUrl,
                        function (data) {
                            packageInfo.language = data.language || '';
                            packageInfo.stars = data.stargazers_count || 0;

                            success(packageInfo);
                        },
                        function (message) {
                            console.log(message);
                        }
                    );

                },
                function (message) {
                    console.log(message);
                }
            );
        },
        renderPackagesList: function (vendor, container, data) {
            var packages = data.packageNames;

            var headerElement = document.createElement('div');
            headerElement.setAttribute('class', 'pf-header');

            var packagistLogoElement = document.createElement('img');
            packagistLogoElement.setAttribute('class', 'pf-packagist-logo');
            packagistLogoElement.setAttribute('src', 'https://packagist.org/bundles/packagistweb/img/logo-small.png');
            headerElement.appendChild(packagistLogoElement);

            var vendorNameElement = document.createElement('div');
            vendorNameElement.setAttribute('class', 'pf-vendor-name');
            vendorNameElement.innerHTML = '<a href="https://packagist.org/users/' + vendor + '/packages/">' + vendor + '</a>';
            headerElement.appendChild(vendorNameElement);

            var list = document.createElement('ul');
            list.setAttribute('class', 'pf-packages-list');

            var footerElement = document.createElement('div');
            footerElement.setAttribute('class', 'pf-footer');

            var packagesFeedTitleElement = document.createTextNode('Public Packages');
            footerElement.appendChild(packagesFeedTitleElement);

            var repositoryLinkElement = document.createElement('a');
            repositoryLinkElement.setAttribute('href', 'https://github.com/htmldriven/packagist-feed/');
            repositoryLinkElement.setAttribute('class', 'pf-pf-repo-link');
            repositoryLinkElement.appendChild(document.createTextNode('Packagist Feed'));

            footerElement.appendChild(repositoryLinkElement);

            for (var i = 0; i < packages.length; i++) {<commit_msg>Update packagist feed img logo URL<commit_after>/**
 * packagist-feed v0.5.0
 * https://github.com/htmldriven/packagist-feed
 *
 * Copyright (c) 2016 <NAME>, HTMLDriven
 * MIT License
 * http://opensource.org/licenses/MIT
 */

var Packagist = (function (document, undefined) {
    'use strict';

    var obj = {};

    var methods = {
        sendRequest: function (url, success, error) {
            var request = new XMLHttpRequest();
            request.open('GET', url);

            request.setRequestHeader('Accept', 'application/json');

            request.onreadystatechange = function () {
                if (request.readyState === 4) {
                    if (request.status >= 200 && request.status < 300) {
                        var data = JSON.parse(request.responseText);
                        success(data);
                    } else {
                        error('request for ' + url + ' yielded status ' + request.status);
                    }
                }
            };

            request.onerror = function () {
                error('An error occurred connecting to ' + url);
            };
            request.send();
        },
        getElement: function (selector) {
            return selector.charAt(0) === '#' ? document.getElementById(selector.substring(1)) : document.getElementsByClassName(selector.substring(1));
        },
        getAsyncPackageInfo: function (packageName, success) {
            var packageUrl = 'https://packagist.org/packages/' + packageName + '.json';
            this.sendRequest(
                packageUrl,
                function (data) {
                    var packageInfo = data.package || null;
                    var gitHubApiUrl = packageInfo.repository.replace('https://github.com', 'https://api.github.com/repos');

                    methods.sendRequest(
                        gitHubApiUrl,
                        function (data) {
                            packageInfo.language = data.language || '';
                            packageInfo.stars = data.stargazers_count || 0;

                            success(packageInfo);
                        },
                        function (message) {
                            console.log(message);
                        }
                    );

                },
                function (message) {
                    console.log(message);
                }
            );
        },
        renderPackagesList: function (vendor, container, data) {
            var packages = data.packageNames;

            var headerElement = document.createElement('div');
            headerElement.setAttribute('class', 'pf-header');

            var packagistLogoElement = document.createElement('img');
            packagistLogoElement.setAttribute('class', 'pf-packagist-logo');
            packagistLogoElement.setAttribute('src', 'https://packagist.org/img/logo-small.png');
            headerElement.appendChild(packagistLogoElement);

            var vendorNameElement = document.createElement('div');
            vendorNameElement.setAttribute('class', 'pf-vendor-name');
            vendorNameElement.innerHTML = '<a href="https://packagist.org/users/' + vendor + '/packages/">' + vendor + '</a>';
            headerElement.appendChild(vendorNameElement);

            var list = document.createElement('ul');
            list.setAttribute('class', 'pf-packages-list');

            var footerElement = document.createElement('div');
            footerElement.setAttribute('class', 'pf-footer');

            var packagesFeedTitleElement = document.createTextNode('Public Packages');
            footerElement.appendChild(packagesFeedTitleElement);

            var repositoryLinkElement = document.createElement('a');
            repositoryLinkElement.setAttribute('href', 'https://github.com/htmldriven/packagist-feed/');
            repositoryLinkElement.setAttribute('class', 'pf-pf-repo-link');
            repositoryLinkElement.appendChild(document.createTextNode('Packagist Feed'));

            footerElement.appendChild(repositoryLinkElement);

            for (var i = 0; i < packages.length; i++) {
{'fraction_non_alphanumeric': 0.11952861952861953, 'fraction_numerical': 0.00456950456950457, 'mean_word_length': 1.7946908602150538, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 14, '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': '1883005', 'n_tokens_mistral': 2046, 'n_tokens_neox': 1933, 'n_words': 357}