<commit_before><?php

namespace CosyVerif\Server;

class Core
{

	private $app;

  public function __construct()
  {
    global $app;

    $app->get('/(users|projects)/:id', function($id) use($app){
      $data = $this->get($app->request->getResourceUri());
      if(!is_null($data)){$app->response->setBody($data);}
    });

    $app->put('/(users|projects)/:id', function($id) use($app){

      $data = $app->request->put("body");
      //echo $data;
      //$this->put($app->request->getResourceUri(), $data);
      //$app->response->setStatus(201);
      //$app->response->setBody($data);
      $app->response->headers->set('Content-Type' : 'application/json');
    });

  }

  /**
     * GET method.
     * 
     * @param  url
     * @return json or cosy format
     */
  public function get($url)
  { 
    $resource = StreamJson::read($url);  
    if(is_array($resource)){
      $resource = json_encode($resource);
    }
    return $resource;
  }

  /**
     * PUT method.
     * 
     * @param  url, data
     * @return boolean
     */
  public function put($url, $data)
  {

    $is_ok = StreamJson::write($url, $data);

    return $is_ok;
  }
}<commit_msg>Correction error<commit_after><?php

namespace CosyVerif\Server;

class Core
{

	private $app;

  public function __construct()
  {
    global $app;

    $app->get('/(users|projects)/:id', function($id) use($app){
      $data = $this->get($app->request->getResourceUri());
      if(!is_null($data)){$app->response->setBody($data);}
    });

    $app->put('/(users|projects)/:id', function($id) use($app){

      $data = $app->request->put("body");
      //echo $data;
      //$this->put($app->request->getResourceUri(), $data);
      //$app->response->setStatus(201);
      //$app->response->setBody($data);
      //$app->response->headers->set('Content-Type' : 'application/json');
    });

  }

  /**
     * GET method.
     * 
     * @param  url
     * @return json or cosy format
     */
  public function get($url)
  { 
    $resource = StreamJson::read($url);  
    if(is_array($resource)){
      $resource = json_encode($resource);
    }
    return $resource;
  }

  /**
     * PUT method.
     * 
     * @param  url, data
     * @return boolean
     */
  public function put($url, $data)
  {

    $is_ok = StreamJson::write($url, $data);

    return $is_ok;
  }
}
{'fraction_non_alphanumeric': 0.20471092077087794, 'fraction_numerical': 0.002569593147751606, 'mean_word_length': 2.5828220858895707, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '750820', 'n_tokens_mistral': 818, 'n_tokens_neox': 788, 'n_words': 133}