Passed
Push — master ( 68443e...939347 )
by Mihail
04:31
created

FormAnswerAdd::make()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 18
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 18
loc 18
rs 9.4285
cc 1
eloc 12
nc 1
nop 0
1
<?php
2
3
namespace Apps\Model\Admin\Feedback;
4
5
use Apps\ActiveRecord\FeedbackAnswer;
6
use Apps\Model\Front\Feedback\FormAnswerAdd as FrontAnswer;
7
use Ffcms\Core\App;
8
9
/**
10
 * Class FormAnswerAdd. Extend front model add answer
11
 * @package Apps\Model\Admin\Feedback
12
 */
13
class FormAnswerAdd extends FrontAnswer
14
{
15 View Code Duplication
    public function make()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
    {
17
        // update readed marker
18
        $this->_post->readed = 1;
19
        $this->_post->save();
20
21
        // add new answer row in database
22
        $record = new FeedbackAnswer();
23
        $record->feedback_id = $this->_post->id;
24
        $record->name = App::$Security->strip_tags($this->name);
25
        $record->email = App::$Security->strip_tags($this->email);
26
        $record->message = App::$Security->strip_tags($this->message);
27
        $record->user_id = $this->_userId;
28
        $record->is_admin = 1;
29
30
        $record->ip = $this->_ip;
31
        $record->save();
32
    }
33
}