<commit_before><?php

/**
 * @file
 * Contains \Drupal\Console\Helper\HttpClientHelper.
 */

namespace Drupal\Console\Helper;

use Drupal\Console\Helper\Helper;
use GuzzleHttp\Client;

/**
 * Class HttpClientHelper
 * @package \Drupal\Console\Helper\HttpClientHelper
 */
class HttpClientHelper extends Helper
{
    public function downloadFile($url, $destination)
    {
        try {
            $this->getClient()->get($url, array('sink' => $destination));

            return true;
        } catch (\Exception $e) {
            return false;
        }
    }

    public function getUrlAsString($url)
    {
        $response = $this->getClient()->get($url);

        if ($response->getStatusCode() == 200) {
            return (string) $response->getBody();
        }

        return null;
    }

    public function getHeader($url, $header)
    {
        $response = $this->getClient()->get($url);
        $headerContent = $response->getHeader($header);
        if (!empty($headerContent) && is_array($headerContent)) {
            return array_shift($headerContent);
        }

        return $headerContent;
    }

    private function getClient()
    {
        return new Client();
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'httpClient';
    }
}
<commit_msg>[console] Remove try/catch to test TravisCI error<commit_after><?php

/**
 * @file
 * Contains \Drupal\Console\Helper\HttpClientHelper.
 */

namespace Drupal\Console\Helper;

use Drupal\Console\Helper\Helper;
use GuzzleHttp\Client;

/**
 * Class HttpClientHelper
 * @package \Drupal\Console\Helper\HttpClientHelper
 */
class HttpClientHelper extends Helper
{
    public function downloadFile($url, $destination)
    {
        $this->getClient()->get($url, array('sink' => $destination));

        return file_exists($destination);
    }

    public function getUrlAsString($url)
    {
        $response = $this->getClient()->get($url);

        if ($response->getStatusCode() == 200) {
            return (string) $response->getBody();
        }

        return null;
    }

    public function getHeader($url, $header)
    {
        $response = $this->getClient()->get($url);
        $headerContent = $response->getHeader($header);
        if (!empty($headerContent) && is_array($headerContent)) {
            return array_shift($headerContent);
        }

        return $headerContent;
    }

    private function getClient()
    {
        return new Client();
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'httpClient';
    }
}

{'fraction_non_alphanumeric': 0.14208702348864075, 'fraction_numerical': 0.0023103581055063534, 'mean_word_length': 2.404980340760157, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '795565', 'n_tokens_mistral': 757, 'n_tokens_neox': 738, 'n_words': 146}