<commit_before><?php
/**
 * Model for Generation
 *
 */

class Generation extends BaseGeneration {

  public function constructId() {
    $this->setDateEmission(date('YmdHis'));
    $this->setIdentifiant($this->type_document.'-'.$this->date_emission);
    $this->set_id('GENERATION-'.$this->identifiant);
    $this->setStatut(GenerationClient::GENERATION_STATUT_ENATTENTE);
  }

  public function save() {
    $this->nb_documents = count($this->documents);
    if (count($this->fichiers) && $this->statut != GenerationClient::GENERATION_STATUT_ENERREUR) {
      $this->setStatut(GenerationClient::GENERATION_STATUT_GENERE);
    } 
    if (!count($this->fichiers) && $this->statut == GenerationClient::GENERATION_STATUT_GENERE) {
	$this->nb_documents = count($this->fichiers);
    }

    $this->setDateMaj(date('YmdHis'));
    return parent::save();
  }

  public function setStatut($statut) {
    if($statut == GenerationClient::GENERATION_STATUT_ENATTENTE) {
      $this->message = "";
    }

    if($statut == GenerationClient::GENERATION_STATUT_ENCOURS) {
      $this->message = "";
    }

    if($statut == GenerationClient::GENERATION_STATUT_ENERREUR) {
      $this->message = "";
    }
    
    return $this->_set('statut', $statut);
  }

  public function reload() {
      $this->remove('fichiers');
      $this->add('fichiers');
      if(count($this->arguments) > 0) {
          $this->add('pregeneration_needed', 1);
      }
      $this->statut = GenerationClient::GENERATION_STATUT_ENATTENTE;
  }

  public function regenerate() {
      $this->somme = 0;
      $documents = array_merge($this->documents->toArray(true, false), $this->add('documents_regenerate')->toArray(true, false));
      $this->add('documents_regenerate', $documents); 
      $this->remove('documents');
      $this->add('documents');
      $this->reload();
  }
  
  public function __toString() {
     return GenerationClient::getInstance()->getDateFromIdGeneration($this->_id);
  }
  
}
<commit_msg>Coquille sur la prise des fichiers<commit_after><?php
/**
 * Model for Generation
 *
 */

class Generation extends BaseGeneration {

  public function constructId() {
    $this->setDateEmission(date('YmdHis'));
    $this->setIdentifiant($this->type_document.'-'.$this->date_emission);
    $this->set_id('GENERATION-'.$this->identifiant);
    $this->setStatut(GenerationClient::GENERATION_STATUT_ENATTENTE);
  }

  public function save() {
    $this->nb_documents = count($this->documents);
    if (count($this->fichiers) && $this->statut != GenerationClient::GENERATION_STATUT_ENERREUR) {
      $this->setStatut(GenerationClient::GENERATION_STATUT_GENERE);
    } 
    if (!$this->nb_documents && $this->statut == GenerationClient::GENERATION_STATUT_GENERE) {
	$this->nb_documents = count($this->fichiers);
    }

    $this->setDateMaj(date('YmdHis'));
    return parent::save();
  }

  public function setStatut($statut) {
    if($statut == GenerationClient::GENERATION_STATUT_ENATTENTE) {
      $this->message = "";
    }

    if($statut == GenerationClient::GENERATION_STATUT_ENCOURS) {
      $this->message = "";
    }

    if($statut == GenerationClient::GENERATION_STATUT_ENERREUR) {
      $this->message = "";
    }
    
    return $this->_set('statut', $statut);
  }

  public function reload() {
      $this->remove('fichiers');
      $this->add('fichiers');
      if(count($this->arguments) > 0) {
          $this->add('pregeneration_needed', 1);
      }
      $this->statut = GenerationClient::GENERATION_STATUT_ENATTENTE;
  }

  public function regenerate() {
      $this->somme = 0;
      $documents = array_merge($this->documents->toArray(true, false), $this->add('documents_regenerate')->toArray(true, false));
      $this->add('documents_regenerate', $documents); 
      $this->remove('documents');
      $this->add('documents');
      $this->reload();
  }
  
  public function __toString() {
     return GenerationClient::getInstance()->getDateFromIdGeneration($this->_id);
  }
  
}

{'fraction_non_alphanumeric': 0.171356783919598, 'fraction_numerical': 0.001507537688442211, 'mean_word_length': 3.9392059553349874, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 79, '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': '1893910', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1266, 'n_words': 165}