<commit_before><?php
namespace Puppy\Client;

use Symfony\Component\DomCrawler\Crawler;

/**
 * Class Response
 * @package Puppy\Client
 * @author <NAME> <<EMAIL>>
 */
class Response 
{
    /**
     * @var string
     */
    private $baseUri;

    /**
     * @var string
     */
    private $response;

    /**
     * @var array
     */
    private $headers;

    /**
     * @var string
     */
    private $content;

    /**
     * @param string $baseUri
     * @param string $response
     */
    public function __construct($baseUri, $response)
    {
        $this->setBaseUri($baseUri);
        $this->setResponse($response);
        $this->init();
    }

    /**
     * @return string
     */
    public function __toString()
    {
        return $this->getResponse();
    }

    /**
     * @return int
     */
    public function getStatusCode()
    {
        return (int)$this->getHeader('Status');
    }

    /**
     * Getter of $headers
     *
     * @return array
     */
    public function getHeaders()
    {
        return $this->headers;
    }


    /**
     * Getter of $headers
     *
     * @param string $key
     * @return array
     */
    public function getHeader($key)
    {
        if (isset($this->headers[$key])) {
            return $this->headers[$key];
        }
        return '';
    }

    /**
     * Getter of $content
     *
     * @return string
     */
    public function getContent()
    {
        return $this->content;
    }

    /**
     * @return Crawler
     */
    public function getDom()
    {
        $crawler = new Crawler(null, $this->getbaseUri());
        $crawler->addContent($this->getContent(), 'text/html'); //todo
        return $crawler;
    }

    /**
     * Getter of $baseUri
     *
     * @return string
     */
    public function getBaseUri()
    {
        return $this->baseUri;
    }
<commit_msg>set dynamically the content type<commit_after><?php
namespace Puppy\Client;

use Symfony\Component\DomCrawler\Crawler;

/**
 * Class Response
 * @package Puppy\Client
 * @author <NAME> <<EMAIL>>
 */
class Response 
{
    /**
     * @var string
     */
    private $baseUri;

    /**
     * @var string
     */
    private $response;

    /**
     * @var array
     */
    private $headers;

    /**
     * @var string
     */
    private $content;

    /**
     * @param string $baseUri
     * @param string $response
     */
    public function __construct($baseUri, $response)
    {
        $this->setBaseUri($baseUri);
        $this->setResponse($response);
        $this->init();
    }

    /**
     * @return string
     */
    public function __toString()
    {
        return $this->getResponse();
    }

    /**
     * @return int
     */
    public function getStatusCode()
    {
        return (int)$this->getHeader('Status');
    }

    /**
     * Getter of $headers
     *
     * @return array
     */
    public function getHeaders()
    {
        return $this->headers;
    }


    /**
     * Getter of $headers
     *
     * @param string $key
     * @return array
     */
    public function getHeader($key)
    {
        if (isset($this->headers[$key])) {
            return $this->headers[$key];
        }
        return '';
    }

    /**
     * Getter of $content
     *
     * @return string
     */
    public function getContent()
    {
        return $this->content;
    }

    /**
     * @return Crawler
     */
    public function getDom()
    {
        $crawler = new Crawler(null, $this->getbaseUri());
        $crawler->addContent($this->getContent(), $this->getHeader('Content-type'));
        return $crawler;
    }

    /**
     * Getter of $baseUri
     *
     * @return string
     */
    public function getBaseUri()
    {
        return $this->baseUri;
    }

{'fraction_non_alphanumeric': 0.14772424807026882, 'fraction_numerical': 0.0, 'mean_word_length': 1.6446164672765657, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 36, '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': '3551496', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1158, 'n_words': 237}