<commit_before><?php

namespace yanivgal;

/**
 * Class JRes
 *
 * This class represents a JSON response message.
 * The structure of the message is implemented per OmniTI Labs describing the
 * JSend specs.
 * Reference: http://labs.omniti.com/labs/jsend
 */
class JRes
{
    const INDEX_STATUS = 'status';
    const INDEX_DATA = 'data';
    const INDEX_MESSAGE = 'message';
    const INDEX_CODE = 'code';

    const STATUS_SUCCESS = 'success';
    const STATUS_FAIL = 'fail';
    const STATUS_ERROR = 'error';

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

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

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

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

    /**
     * @var int
     */
    private $errorCode;

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

    /**
     * @param JRes::STATUS_SUCCESS|JRes::STATUS_FAIL|JRes::STATUS_ERROR $status
     * @param array $data
     * @param string $message
     * @param string $jsonpCallback
     */
    public function __construct(
        $status,
        array $data = null,
        $message = null,
        $jsonpCallback = null
    ) {
        $this->status = $status;
        $this->data = $data;
        $this->message = $message;
        $this->jsonpCallback = $jsonpCallback;
    }

    /**
     * @param JRes::STATUS_SUCCESS|JRes::STATUS_FAIL|JRes::STATUS_ERROR $status
     * @return JRes
     */
    public function status($status)
    {
        $this->status = $status;
        return $this;
    }

    /**
     * @param array $data
     * @return JRes
     */
    public function data(array $data)
    {
        $this->data = $data;
        return $this;
    }

    /**
     * @param string $key
     * @param string $value
     * @return JRes
     */
    public function addData($key, $value)
    {
        if (isset($key)) {
            $this->data[$key] = $value;
        }
        return $this;
    }<commit_msg>Data can array or string<commit_after><?php

namespace yanivgal;

/**
 * Class JRes
 *
 * This class represents a JSON response message.
 * The structure of the message is implemented per OmniTI Labs describing the
 * JSend specs.
 * Reference: http://labs.omniti.com/labs/jsend
 */
class JRes
{
    const INDEX_STATUS = 'status';
    const INDEX_DATA = 'data';
    const INDEX_MESSAGE = 'message';
    const INDEX_CODE = 'code';

    const STATUS_SUCCESS = 'success';
    const STATUS_FAIL = 'fail';
    const STATUS_ERROR = 'error';

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

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

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

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

    /**
     * @var int
     */
    private $errorCode;

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

    /**
     * @param JRes::STATUS_SUCCESS|JRes::STATUS_FAIL|JRes::STATUS_ERROR $status
     * @param array|string $data
     * @param string $message
     * @param string $jsonpCallback
     */
    public function __construct(
        $status,
        $data = null,
        $message = null,
        $jsonpCallback = null
    ) {
        $this->status = $status;
        $this->data = $data;
        $this->message = $message;
        $this->jsonpCallback = $jsonpCallback;
    }

    /**
     * @param JRes::STATUS_SUCCESS|JRes::STATUS_FAIL|JRes::STATUS_ERROR $status
     * @return JRes
     */
    public function status($status)
    {
        $this->status = $status;
        return $this;
    }

    /**
     * @param array|string $data
     * @return JRes
     */
    public function data($data)
    {
        $this->data = $data;
        return $this;
    }

    /**
     * @param string $key
     * @param string $value
     * @return JRes
     */
    public function addData($key, $value)
    {
        if (isset($key)) {
            $this->data[$key] = $value;
        }
        return $this;
    }
{'fraction_non_alphanumeric': 0.13350062735257215, 'fraction_numerical': 0.0, 'mean_word_length': 1.8989090909090909, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '1817814', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1250, 'n_words': 300}