Code Duplication    Length = 5-5 lines in 2 locations

src/models/Comments.php 1 location

@@ 378-382 (lines=5) @@
375
                }
376
            }
377
378
            if ($this->hasAttribute('ip')) {
379
                if ($this->getAttribute('ip') === null) {
380
                    $this->setAttribute('ip', Yii::$app->request->getUserIP());
381
                }
382
            }
383
384
            if ($this->hasAttribute('main_parent_id') && $this->hasAttribute('parent_id')) {
385
                if ($this->scenario !== 'default') {

src/models/CommentsRating.php 1 location

@@ 121-125 (lines=5) @@
118
    public function beforeSave($insert)
119
    {
120
        if (parent::beforeSave($insert)) {
121
            if ($this->hasAttribute('ip')) {
122
                if ($this->getAttribute('ip') === null) {
123
                    $this->setAttribute('ip', Yii::$app->request->getUserIP());
124
                }
125
            }
126
127
            if ($this->hasAttribute('comment_id')) {
128
                $comment_id = $this->getAttribute('comment_id');