<commit_before><?php

/**
 * This class converts csv file content into json
 */
class tojson {
  function __construct($file) {
    $json = array();
    // Constructor to handle file
    if ((!file_exists($file)) || (!is_readable($file)) ) {
      return "err: you passed me an invalid file";
    } else if (empty($file)) {
      return "err: pass me a csv file";
    } else {
      $this->json = array_map('str_getcsv', file($file));
      //$this->json = json_encode($this->json);
    }
    $this->json = json_encode($this->json);
    // return json file content
    //return $json;
  }


}



 ?><commit_msg>made json private, use getjson method for result<commit_after><?php

/**
 * This class converts csv file content into json
 */
class tojson {
  private $json;
  function __construct($file) {
    // Constructor to handle file
    if ((!file_exists($file)) || (!is_readable($file)) ) {
      $this->json = "err: you passed me an invalid file";
    } else if (empty($file)) {
      $this->json = "err: pass me a csv file";
    } else {
      $this->json = array_map('str_getcsv', file($file));
      //$this->json = json_encode($this->json);
    }
    $this->json = json_encode($this->json);
    // return json file content
    //return $json;
  }

  public function getjson() {
    // this will return the json value
    return $this->json;
  }


}



 ?>
{'fraction_non_alphanumeric': 0.16287600880410857, 'fraction_numerical': 0.0, 'mean_word_length': 2.736986301369863, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, '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': '3546974', 'n_tokens_mistral': 444, 'n_tokens_neox': 428, 'n_words': 126}