<commit_before><?php
namespace Seloger;

class Request
{
    private $params = [];

    const URL_API = 'http://ws.seloger.com';
    const USERAGENT = 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36';

    /**
     * Make request to SeLoger.com api
     * @param  string $type
     * @return SimpleXMLElement
     */
    public function run()
    {
        // Prepare Url
        $query = http_build_query($this->params);
        $url = self::URL_API . '/' . $this->type . '.xml?' . $query;

        $curl = curl_init();

        // Prepare options
        $options = [
            CURLOPT_URL            => $url,
            CURLOPT_USERAGENT      => self::USERAGENT,
            CURLOPT_FOLLOWLOCATION => true,
            CURLOPT_TIMEOUT        => 5,
            CURLOPT_RETURNTRANSFER => true
        ];
        curl_setopt_array($curl, $options);

        // exec
        $response = curl_exec($curl);
        $headers = curl_getinfo($curl);

        if(curl_errno($curl))
            throw new Exception('[SELOGER] ' . curl_error($curl));

        // Throw when not OK
        if ($headers['http_code'] !== 200)
            throw new \Exception("[SELOGER] failed to request " . $url . ". returning " . $headers['http_code']);

        curl_close($curl);

        // Get xml return stdClass
        $xml = new \SimpleXMLElement($response);
        $json = json_encode($xml);
        return json_decode($json);
    }
<commit_msg>exception was not in common namespace<commit_after><?php
namespace Seloger;

class Request
{
    private $params = [];

    const URL_API = 'http://ws.seloger.com';
    const USERAGENT = 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36';

    /**
     * Make request to SeLoger.com api
     * @param  string $type
     * @return SimpleXMLElement
     */
    public function run()
    {
        // Prepare Url
        $query = http_build_query($this->params);
        $url = self::URL_API . '/' . $this->type . '.xml?' . $query;

        $curl = curl_init();

        // Prepare options
        $options = [
            CURLOPT_URL            => $url,
            CURLOPT_USERAGENT      => self::USERAGENT,
            CURLOPT_FOLLOWLOCATION => true,
            CURLOPT_TIMEOUT        => 5,
            CURLOPT_RETURNTRANSFER => true
        ];
        curl_setopt_array($curl, $options);

        // exec
        $response = curl_exec($curl);
        $headers = curl_getinfo($curl);

        if(curl_errno($curl))
            throw new \Exception('[SELOGER] ' . curl_error($curl));

        // Throw when not OK
        if ($headers['http_code'] !== 200)
            throw new \Exception("[SELOGER] failed to request " . $url . ". returning " . $headers['http_code']);

        curl_close($curl);

        // Get xml return stdClass
        $xml = new \SimpleXMLElement($response);
        $json = json_encode($xml);
        return json_decode($json);
    }

{'fraction_non_alphanumeric': 0.13821677162744447, 'fraction_numerical': 0.019887305270135897, 'mean_word_length': 1.9559255631733594, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '4518339', 'n_tokens_mistral': 1011, 'n_tokens_neox': 932, 'n_words': 205}