<commit_before><?php

namespace Sdmx\api\client\http;


use Requests;

class RequestHttpClient implements HttpClient
{
    /**
     * @var array $predefinedHeaders
     */
    private $predefinedHeaders = [];

    /**
     * @param string $url
     * @param array $headers
     * @param array $options
     * @return string
     */
    public function get($url, $headers = array('Accept' => 'application/xml', 'Accept-Encoding' => 'gzip'), $options = array())
    {
        $headersToSend = array_merge($this->predefinedHeaders, $headers);
        $response =  Requests::get($url, $headersToSend, $options);

        return $response->body;
    }

    /**
     * @param array $headers
     */
    public function setPredefinedHeaders(array $headers)<commit_msg>Return null when a response is not succesful.<commit_after><?php

namespace Sdmx\api\client\http;


use Requests;

class RequestHttpClient implements HttpClient
{
    /**
     * @var array $predefinedHeaders
     */
    private $predefinedHeaders = [];

    /**
     * @param string $url
     * @param array $headers
     * @param array $options
     * @return string
     */
    public function get($url, $headers = array('Accept' => 'application/xml', 'Accept-Encoding' => 'gzip'), $options = array())
    {
        $headersToSend = array_merge($this->predefinedHeaders, $headers);
        $response =  Requests::get($url, $headersToSend, $options);
        
        return $response->success ? $response->body : null;
    }

    /**
     * @param array $headers
     */
    public function setPredefinedHeaders(array $headers)
{'fraction_non_alphanumeric': 0.13836477987421383, 'fraction_numerical': 0.0, 'mean_word_length': 2.8616504854368934, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2004153', 'n_tokens_mistral': 462, 'n_tokens_neox': 455, 'n_words': 110}