<commit_before><?php
if (!defined('BASEPATH')) exit ('No direct script access allowed');

/**
 * A helper function for returning music helper's responces.
 *
 * @param object $query.
 *
 * @param string $human_readable.
 *
 * @return string JSON.
 */
if (!function_exists('_json_return_helper')) {
  function _json_return_helper($query, $human_readable) {
    if ($query->num_rows() > 0) {
      if (!empty($human_readable) && $human_readable != 'false') {
        $ci=& get_instance();
        $ci->load->database();

        // Load helpers
        $ci->load->helper(array('text_helper'));
        header("HTTP/1.1 200 OK");
        return indentJSON(json_encode($query->result()));
      }
      else {
        header("HTTP/1.1 200 OK");
        return json_encode($query->result());
      }
      header("HTTP/1.1 400 Bad Request");
      return json_encode(array('error' => array('msg' => ERR_GENERAL)));
    }
    else {
      if (!empty($human_readable) && $human_readable != 'false') {
        $ci=& get_instance();
        $ci->load->database();

        // Load helpers
        $ci->load->helper(array('text_helper'));
        header("HTTP/1.1 204 No Content");
        exit ();
      }
      else {
        header("HTTP/1.1 204 No Content");
        exit ();
      }
      header("HTTP/1.1 400 Bad Request");
      return json_encode(array('error' => array('msg' => ERR_GENERAL)));
    }
  }
}
?><commit_msg>Made return helper more neat by returning the header() function call.<commit_after><?php
if (!defined('BASEPATH')) exit ('No direct script access allowed');

/**
 * A helper function for returning music helper's responces.
 *
 * @param object $query.
 *
 * @param string $human_readable.
 *
 * @return string JSON.
 */
if (!function_exists('_json_return_helper')) {
  function _json_return_helper($query, $human_readable) {
    if ($query->num_rows() > 0) {
      if (!empty($human_readable) && $human_readable != 'false') {
        $ci=& get_instance();
        $ci->load->database();

        // Load helpers
        $ci->load->helper(array('text_helper'));
        header("HTTP/1.1 200 OK");
        return indentJSON(json_encode($query->result()));
      }
      else {
        header("HTTP/1.1 200 OK");
        return json_encode($query->result());
      }
      header("HTTP/1.1 400 Bad Request");
      return json_encode(array('error' => array('msg' => ERR_GENERAL)));
    }
    else {
      if (!empty($human_readable) && $human_readable != 'false') {
        $ci=& get_instance();
        $ci->load->database();

        // Load helpers
        $ci->load->helper(array('text_helper'));
        return header("HTTP/1.1 204 No Content");
      }
      else {
        return header("HTTP/1.1 204 No Content");
      }
      header("HTTP/1.1 400 Bad Request");
      return json_encode(array('error' => array('msg' => ERR_GENERAL)));
    }
  }
}
?>
{'fraction_non_alphanumeric': 0.17640918580375783, 'fraction_numerical': 0.021572720946416143, 'mean_word_length': 2.667091836734694, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '2255160', 'n_tokens_mistral': 925, 'n_tokens_neox': 867, 'n_words': 196}