<commit_before><?php

namespace Buzz\Message;

/**
 * FormRequest.
 *
 * @author <NAME> <<EMAIL>>
 */
class FormRequest extends Request
{
    protected $fields = array();

    public function __construct($method = self::METHOD_POST, $resource = '/', $host = null)
    {
        parent::__construct($method, $resource, $host);
    }

    public function setField($name, $value)
    {
        $this->fields[$name] = $value;
    }

    public function getFields()
    {
        return $this->fields;
    }

    public function setFields(array $fields)
    {
        $this->fields = $fields;
    }

    public function setContent($content)
    {
        throw new \BadMethodCallException('It is not permitted to set the content.');
    }

    public function getContent()
    {
        return http_build_query($this->fields);
    }

    public function getHeaders()
    {
        return array_merge(parent::getHeaders(), array(
            'Content-Type: application/x-www-form-urlencoded',
            'Content-Length: '.strlen($this->getContent()),
        ));
    }
}<commit_msg>moved setting of content-type header to constructor<commit_after><?php

namespace Buzz\Message;

/**
 * FormRequest.
 *
 * @author <NAME> <<EMAIL>>
 */
class FormRequest extends Request
{
    private $fields = array();

    public function __construct($method = self::METHOD_POST, $resource = '/', $host = null)
    {
        parent::__construct($method, $resource, $host);

        $this->addHeader('Content-Type: application/x-www-form-urlencoded');
    }

    public function setField($name, $value)
    {
        $this->fields[$name] = $value;
    }

    public function getFields()
    {
        return $this->fields;
    }

    public function setFields(array $fields)
    {
        $this->fields = $fields;
    }

    public function setContent($content)
    {
        throw new \BadMethodCallException('It is not permitted to set the content.');
    }

    public function getContent()
    {
        return http_build_query($this->fields);
    }
}
{'fraction_non_alphanumeric': 0.13723561239547466, 'fraction_numerical': 0.0, 'mean_word_length': 2.625668449197861, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4418237', 'n_tokens_mistral': 596, 'n_tokens_neox': 583, 'n_words': 136}