<commit_before><?php

namespace Phuggles;

class Request {
    static public function get($path, $parameters = array()) {
        $parameters = array_merge($parameters, array("token" => Configuration::$public_token));
        $path       = $path . "?" . http_build_query($parameters);

        return self::request($path);
    }

    static public function post($path, $parameters = array()) {
        $parameters = array_merge($parameters, array("token" => Configuration::$private_token));
        $options    = array(
            CURLOPT_POST       => 1,
            CURLOPT_POSTFIELDS => http_build_query($parameters)
        );

        return self::request($path, $options);
    }

    static public function delete($path) {
        $parameters = array("token" => Configuration::$private_token);
        $options    = array(
            CURLOPT_POSTFIELDS    => http_build_query($parameters),
            CURLOPT_CUSTOMREQUEST => "DELETE"
        );

        return self::request($path, $options);
    }

    static private function request($path, $options = array()) {
        $handle = curl_init();

        curl_setopt($handle, CURLOPT_URL, Configuration::$host . $path);
        curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);

        foreach ($options as $key => $value) {
            curl_setopt($handle, $key, $value);
        }

        $response = curl_exec($handle);<commit_msg>prefixed the 'request' function with an underscore to avoid issues with PHP versions >5.3.0 and <=5.3.2.<commit_after><?php

namespace Phuggles;

class Request {
    static public function get($path, $parameters = array()) {
        $parameters = array_merge($parameters, array("token" => Configuration::$public_token));
        $path       = $path . "?" . http_build_query($parameters);

        return self::_request($path);
    }

    static public function post($path, $parameters = array()) {
        $parameters = array_merge($parameters, array("token" => Configuration::$private_token));
        $options    = array(
            CURLOPT_POST       => 1,
            CURLOPT_POSTFIELDS => http_build_query($parameters)
        );

        return self::_request($path, $options);
    }

    static public function delete($path) {
        $parameters = array("token" => Configuration::$private_token);
        $options    = array(
            CURLOPT_POSTFIELDS    => http_build_query($parameters),
            CURLOPT_CUSTOMREQUEST => "DELETE"
        );

        return self::_request($path, $options);
    }

    static private function _request($path, $options = array()) {
        $handle = curl_init();

        curl_setopt($handle, CURLOPT_URL, Configuration::$host . $path);
        curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);

        foreach ($options as $key => $value) {
            curl_setopt($handle, $key, $value);
        }

        $response = curl_exec($handle);
{'fraction_non_alphanumeric': 0.1365684575389948, 'fraction_numerical': 0.0034662045060658577, 'mean_word_length': 2.76271186440678, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 20, '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': '7208120', 'n_tokens_mistral': 817, 'n_tokens_neox': 793, 'n_words': 174}