<commit_before><?php

class Campaign {

  public $nid;
  protected $node;

  public function __construct($id) {
    $this->nid = $id;
    $this->node = node_load($id);

    if ($this->node->type === 'campaign') {
      $this->title = $this->node->title;
      $this->created = $this->node->created;
      $this->updated = $this->node->changed;
      $this->status = $this->getStatus();
    }
    else {
      throw new Exception('Campaign does not exist!');
    }
  }


  protected function getStatus() {
    // @TODO: consider repurposing code from below called function and using inside this method.
    return dosomething_campaign_get_campaign_status($this->node);
  }

}<commit_msg>Updates to Campaign class methods.<commit_after><?php

class Campaign {

  public $nid;
  protected $node;

  public function __construct($id) {
    $this->nid = $id;
    $this->node = node_load($id);

    if ($this->node->type === 'campaign') {
      $this->title = $this->node->title;
      $this->created = $this->node->created;
      $this->updated = $this->node->changed;
      $this->status = $this->getStatus();
      $this->type = $this->getType();
      $this->scholarship = $this->getScholarship();
    }
    else {
      throw new Exception('Campaign does not exist!');
    }
  }


  protected function getTagline() {

  }

  protected function getScholarship() {
    return $this->extractValue($this->node->field_scholarship_amount);
  }


  protected function getStatus() {
    return $this->extractValue($this->node->field_campaign_status);
  }


  protected function getType() {
    return $this->extractValue($this->node->field_campaign_type);
  }


  protected function extractValue($field) {
    $field = $field[LANGUAGE_NONE][0];

    if ($field['value']) {
      if (isset($field['safe_value'])) {
        return $field['safe_value'];
      }
      return $field['value'];
    }

    return NULL;
  }
}
{'fraction_non_alphanumeric': 0.1650943396226415, 'fraction_numerical': 0.0005241090146750524, 'mean_word_length': 3.1053763440860216, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, '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': '6987616', 'n_tokens_mistral': 616, 'n_tokens_neox': 590, 'n_words': 123}