<commit_before><?php
/* This class is part of the XP framework
 *
 * $Id$ 
 */
 
  uses(
    'org.bugzilla.db.BugzillaLongDescs',
    'util.Date'
  );

  /**
   * Bugzilla comment accessor class
   *
   * @purpose  Simplify handling with bugzilla comments
   */
  class BugzillaComment extends Object {
    public
      $bug_id=      NULL,
      $user_id=     NULL,
      $comment=     NULL;
   

    /**
     * Constructor
     *
     * @param   int bug_id,     The ID of the bug related to this comment
     * @param   int user_id,    The bugzilla user id
     * @param   string comment, The comment
     */
    public function __construct($bug_id= NULL, $user_id= NULL, $comment= NULL) {
      $this->bug_id= $bug_id;
      $this->user_id= $user_id;
      $this->comment= $comment;
    }    
    
    /**
     * Set Bug_id
     *
     * @param   int bug_id
     */
    public function setBug_id($bug_id) {
      $this->bug_id= $bug_id;
    }

    /**
     * Get Bug_id
     *
     * @return  int bug_id
     */
    public function getBug_id() {
      return $this->bug_id;
    }

    /**
     * Set User_id
     *
     * @param   int user_id
     */
    public function setUser_id($user_id) {
      $this->user_id= $user_id;
    }

    /**
     * Get User_id
     *
     * @return  int user_id
     */
    public function getUser_id() {
      return $this->user_id;
    }

    /**
     * Set Comment
     *
     * @param   string comment
     */
    public function setComment($comment) {
      $this->comment= $comment;
    }

    /**
     * Get Comment
     *
     * @return  string
     */
    public function getComment() {
      return $this->comment;
    }
    
    /**
     * Add a comment
     *
     * @throws  lang.IllegalArgumentException
     * @throws  rdbms.SQLException
     * @return  bool
     */
    public function add() {

      // Check if all needed params are given
      if (
        empty($this->bug_id) or
        empty($this->user_id) or
        empty($this->comment)
      ) throw(new IllegalArgumentException('Too few arguments given'));

      try {
        with ($desc= new BugzillaLongDescs()); {
          $desc->setBug_id($this->bug_id);
          $desc->setBug_when(Date::now());
          $desc->setThetext($this->comment);
          $desc->setWho($this->user_id);
        }
        $desc->insert();
        
      } catch (SQLException $e) {
        throw($e);
      }
      return TRUE;
    }
  }
?><commit_msg>- Remove useless try { } } catch (SQLException $e) {  throw($e); } block<commit_after><?php
/* This class is part of the XP framework
 *
 * $Id$ 
 */
 
  uses(
    'org.bugzilla.db.BugzillaLongDescs',
    'util.Date'
  );

  /**
   * Bugzilla comment accessor class
   *
   * @purpose  Simplify handling with bugzilla comments
   */
  class BugzillaComment extends Object {
    public
      $bug_id=      NULL,
      $user_id=     NULL,
      $comment=     NULL;
   

    /**
     * Constructor
     *
     * @param   int bug_id,     The ID of the bug related to this comment
     * @param   int user_id,    The bugzilla user id
     * @param   string comment, The comment
     */
    public function __construct($bug_id= NULL, $user_id= NULL, $comment= NULL) {
      $this->bug_id= $bug_id;
      $this->user_id= $user_id;
      $this->comment= $comment;
    }    
    
    /**
     * Set Bug_id
     *
     * @param   int bug_id
     */
    public function setBug_id($bug_id) {
      $this->bug_id= $bug_id;
    }

    /**
     * Get Bug_id
     *
     * @return  int bug_id
     */
    public function getBug_id() {
      return $this->bug_id;
    }

    /**
     * Set User_id
     *
     * @param   int user_id
     */
    public function setUser_id($user_id) {
      $this->user_id= $user_id;
    }

    /**
     * Get User_id
     *
     * @return  int user_id
     */
    public function getUser_id() {
      return $this->user_id;
    }

    /**
     * Set Comment
     *
     * @param   string comment
     */
    public function setComment($comment) {
      $this->comment= $comment;
    }

    /**
     * Get Comment
     *
     * @return  string
     */
    public function getComment() {
      return $this->comment;
    }
    
    /**
     * Add a comment
     *
     * @throws  lang.IllegalArgumentException
     * @throws  rdbms.SQLException
     * @return  bool
     */
    public function add() {

      // Check if all needed params are given
      if (
        empty($this->bug_id) or
        empty($this->user_id) or
        empty($this->comment)
      ) throw(new IllegalArgumentException('Too few arguments given'));

      with ($desc= new BugzillaLongDescs()); {
        $desc->setBug_id($this->bug_id);
        $desc->setBug_when(Date::now());
        $desc->setThetext($this->comment);
        $desc->setWho($this->user_id);
      }
      $desc->insert();
        
      return TRUE;
    }
  }
?>
{'fraction_non_alphanumeric': 0.1287940935192781, 'fraction_numerical': 0.0, 'mean_word_length': 1.7352776219854178, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 45, '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': '5521785', 'n_tokens_mistral': 1640, 'n_tokens_neox': 1582, 'n_words': 359}