Code Duplication    Length = 11-14 lines in 3 locations

src/Comment/CommentModel.php 2 locations

@@ 126-137 (lines=12) @@
123
     *
124
     * @return void
125
     */
126
    public function updateComment($id, $comment)
127
    {
128
        // Connect to db
129
        $com = new Comments();
130
        $com->setDb($this->di->get("db"));
131
        // Get comment
132
        $com->find("id", $id);
133
        // Update comment
134
        $com->comment = $comment["comment"];
135
        // Save
136
        $com->save();
137
    }
138
139
140
    /**
@@ 147-160 (lines=14) @@
144
     *
145
     * @return void
146
     */
147
    public function deleteComment($id)
148
    {
149
        // Set default timezone
150
        date_default_timezone_set('Europe/Stockholm');
151
        // Connect to db
152
        $com = new Comments();
153
        $com->setDb($this->di->get("db"));
154
        // Get comment
155
        $com->find("id", $id);
156
        // Delete (Update) comment
157
        $com->deleted = date("Y-m-d H:i:s");
158
        // Save
159
        $com->save();
160
    }
161
}
162

src/User/UserModel.php 1 location

@@ 182-192 (lines=11) @@
179
     *
180
     * @return object $user the deleted useer
181
     */
182
    public function deleteUser($id)
183
    {
184
        // Get user from db
185
        $user = new User();
186
        $user->setDb($this->di->get("db"));
187
        $user->find("id", $id);
188
        // Delete user (Set Deleted to timestamp)
189
        $user->deleted = date("Y-m-d H:i:s");
190
        $user->save();
191
        return $user;
192
    }
193
}
194