Code Duplication    Length = 16-17 lines in 2 locations

Apps/Model/Api/Comments/CommentAnswerAdd.php 1 location

@@ 103-119 (lines=17) @@
100
     * Add comment answer to database and return active record object
101
     * @return CommentAnswer
102
     */
103
    public function buildRecord()
104
    {
105
        $record = new CommentAnswer();
106
        $record->comment_id = $this->replayTo;
107
        $record->user_id = $this->_userId;
108
        $record->guest_name = $this->guestName;
109
        $record->message = $this->message;
110
        $record->lang = App::$Request->getLanguage();
111
        $record->ip = $this->ip;
112
        // check if premoderation is enabled and user is guest
113
        if ((int)$this->_configs['guestModerate'] === 1 && $this->_userId < 1) {
114
            $record->moderate = 1;
115
        }
116
        $record->save();
117
118
        return $record;
119
    }
120
121
}

Apps/Model/Api/Comments/CommentPostAdd.php 1 location

@@ 108-123 (lines=16) @@
105
     * Insert new comment in table and return active record object
106
     * @return CommentPost
107
     */
108
    public function buildRecord()
109
    {
110
        $record = new CommentPost();
111
        $record->pathway = $this->pathway;
112
        $record->user_id = $this->_userId;
113
        $record->guest_name = $this->guestName;
114
        $record->message = $this->message;
115
        $record->lang = App::$Request->getLanguage();
116
        // check if premoderation is enabled and user is guest
117
        if ((int)$this->_configs['guestModerate'] === 1 && $this->_userId < 1) {
118
            $record->moderate = 1;
119
        }
120
        $record->save();
121
122
        return $record;
123
    }
124
}