<commit_before><?php
/**
 * @author    <NAME> <<EMAIL>>
 * @copyright 2016
 *
 * @link      https://www.github.com/janhuang
 * @link      http://www.fast-d.cn/
 */

namespace FastD\Http;

/**
 * Class JsonResponse
 *
 * @package FastD\Http
 */
class JsonResponse extends Response
{
    /**
     * Constructor.
     *
     * @param mixed $data    The response data
     * @param int   $status  The response status code
     * @param array $headers An array of response headers
     */
    public function __construct(array $data, $status = 200, $headers = array())
    {
        $json = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);

        $this->withContentType('application/json; charset=UTF-8');

        parent::__construct($json, $status, $headers);
    }

    /**
     * @return mixed
     */
    public function toArray()
    {
        return json_decode($this->getContents(), true);
    }
}<commit_msg>fixed response number check<commit_after><?php
/**
 * @author    <NAME> <<EMAIL>>
 * @copyright 2016
 *
 * @link      https://www.github.com/janhuang
 * @link      http://www.fast-d.cn/
 */

namespace FastD\Http;

/**
 * Class JsonResponse
 *
 * @package FastD\Http
 */
class JsonResponse extends Response
{
    const JSON_OPTIONS = JSON_UNESCAPED_UNICODE;

    /**
     * Constructor.
     *
     * @param mixed $data    The response data
     * @param int   $status  The response status code
     * @param array $headers An array of response headers
     */
    public function __construct(array $data, $status = 200, $headers = array())
    {
        $json = json_encode($data, static::JSON_OPTIONS);

        $this->withContentType('application/json; charset=UTF-8');

        parent::__construct($json, $status, $headers);
    }

    /**
     * @return mixed
     */
    public function toArray()
    {
        return json_decode($this->getContents(), true);
    }
}
{'fraction_non_alphanumeric': 0.1405263157894737, 'fraction_numerical': 0.008421052631578947, 'mean_word_length': 2.553271028037383, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, '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': '2717485', 'n_tokens_mistral': 608, 'n_tokens_neox': 581, 'n_words': 139}