<commit_before><?php

namespace Magyarjeti\Loripsum\Http;

class CurlAdapter implements AdapterInterface
{
    public $timeout = 5;

    public function request($url)
    {
        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout);

        $response = curl_exec($ch);

        curl_close($ch);

        return $response;
    }
}<commit_msg>Fix #1 - Throw exception on curl timeout<commit_after><?php

namespace Magyarjeti\Loripsum\Http;

class CurlAdapter implements AdapterInterface
{
    public $timeout = 5;

    public function request($url)
    {
        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout);

        $response = curl_exec($ch);

        curl_close($ch);

        if ($response === false) {
            throw new \RuntimeException('Connection timeout.');
        }

        return $response;
    }
}
{'fraction_non_alphanumeric': 0.12007332722273144, 'fraction_numerical': 0.002749770852428964, 'mean_word_length': 2.8450704225352115, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6604060', 'n_tokens_mistral': 355, 'n_tokens_neox': 339, 'n_words': 71}